diff options
Diffstat (limited to 'admin/include')
-rw-r--r-- | admin/include/functions_metadata.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/admin/include/functions_metadata.php b/admin/include/functions_metadata.php index 5d1f80bc2..b1c32dc62 100644 --- a/admin/include/functions_metadata.php +++ b/admin/include/functions_metadata.php @@ -38,7 +38,18 @@ function get_sync_iptc_data($file) { if (preg_match('/(\d{4})(\d{2})(\d{2})/', $value, $matches)) { - $iptc[$pwg_key] = $matches[1].'-'.$matches[2].'-'.$matches[3]; + $year = $matches[1]; + $month = $matches[2]; + $day = $matches[3]; + + if (!checkdate($month, $day, $year)) + { + // we suppose the year is correct + $month = 1; + $day = 1; + } + + $iptc[$pwg_key] = $year.'-'.$month.'-'.$day; } } } |