Quantcast
Channel: Zenphoto forum
Viewing all articles
Browse latest Browse all 2917

walterbz on "Formatting exif date format"

$
0
0

I was looking for a way to display the exif date in the european format:
day-month-year hour:minute instead of year-day-month

Since I didn't found a setting or a solution I made a little mod in the template-function.php line 2387 and below.

Original:

<?php
foreach ($exif as $field => $value) {
$label = $_zp_exifvars[$field][2];
echo "<tr><td class=\"label\">$label:</td><td class=\"value\">";
echo html_encode($value);
echo "</td></tr>\n";
}
?>

modified:

<?php
foreach ($exif as $field => $value) {
$label = $_zp_exifvars[$field][2];
echo "<tr><td class=\"label\">$label:</td><td class=\"value\">";
if ($field=="EXIFDateTimeOriginal" || $field=="EXIFDateTime"){
$date = new DateTime($value);
echo date_format($date, 'd/m/Y H:i:s');
}else{
echo html_encode($value);
};
echo "</td></tr>\n";
}
?>

I know that is not a good solution to modify the core files. Every update I must remember to do the same mod.
It would be nice to modify the code with a variable setting in admin (the date format 'd/m/Y H:i:s') so it would be possible to customize as needed.

Perhaps there is another "cleaner" solution. In case let me know, Thank you
Walter


Viewing all articles
Browse latest Browse all 2917

Latest Images

Trending Articles



Latest Images