View Full Version : EXIF_CAPTURE_DATE format
witty
04-13-2007, 03:30 PM
Hi,
Is there a hack or script, or whatever, available for making the format of EXIF_CAPTURE_DATE a bit more "user friendly"?
Right now, the format displays as:
2006:10:05 16:14:28
I'd prefer it to be displayed in the same format as (my) IMAGE_DATETIME
Oct 5, 2006 - 16:14:28
Possible?
-Witty
Dennis
04-13-2007, 04:00 PM
yeah pretty much, perhaps I can whip something up provided I have the time.
witty
04-13-2007, 04:14 PM
Hi,
Great thanks... much appreciated. It's not like it's deal-breaker or anything, but my blog sort of depends on image capture times moreso than image posting times. So having a format that's easier to read would be cool.
-Witty
Dennis
04-13-2007, 04:43 PM
Ok here ya go: I'm assuming your running version 1.6: open functions_exif.php in your includes folder. Use an ASCII editor, preferably one that understands unix style text files.
Go to line 77
$capture_date = $exif_result['DateTimeOriginalSubIFD']; // Date and Time
Add the following code below that line:
$capture_date = gmdate('M j, Y - H:i', strtotime($capture_date)+(3600*$cfgrow['timezone']));
Save, upload and enjoy.
witty
04-13-2007, 06:08 PM
Hi,
Will it work in 1.5 (I suppose I could just try it)? I haven't upgraded to 1.6 yet... which I will as soon as I'm done building the site. Thanks!
-Witty
EDIT:
OK, just tried it. It "works", but somehow changes all of the dates to:
Dec 31, 1969 - 23:59
Dennis
04-13-2007, 08:47 PM
ok, I'll look at it later.
Dennis
04-15-2007, 10:04 AM
Try this:
$capture_date = gmdate('M j, Y - H:i', $capture_date+(3600*$cfgrow['timezone']));
dhdesign
04-15-2007, 01:04 PM
Thought this was a neat idea, so I just tried the latest code that you posted, and this is the date that I am getting with mine:
Jan 1, 1970 - 00:00
Dennis
04-15-2007, 01:50 PM
Go to the function replace_exif_tags ($language_full, $image_exif, $tpl). Place the following line right after the {
global $cfgrow;
Go to line 78
$capture_date = $exif_result['DateTimeOriginalSubIFD']; // Date and Time
replace with:
$capture_date = date($cfgrow['dateformat'],strtotime($exif_result['DateTimeOriginalSubIFD'])); // Date and Time
Save, upload and enjoy.
dhdesign
04-15-2007, 02:04 PM
Still not working for me - after the above changes, I get:
Dec 31, 1969 - 20:00
Just wondering - my PP install is on a server that is using PHP version 5.1.4. Could that be causing a conflict with your proposed changes?
Dennis
04-15-2007, 06:15 PM
You did remove the older proposed code? I've tested it on PHP 5.14
dhdesign
04-15-2007, 06:28 PM
Yes, I removed the old code and put in what you posted.
I've sent you an email with the link you requested. :)
Dennis
05-08-2007, 05:52 PM
No, it can not.
I'm pretty much sure it works. I have it on my blog this way. Could you send me the picture so I can check.
Ow and sorry for the late reply.
witty
05-08-2007, 08:16 PM
Hi,
I'm getting "Dec 31, 1969 - 18:59" for all of my images (except for the ones that were scanned from original photos, but I'm not worried about those).
-Witty
Dennis
05-08-2007, 08:43 PM
Server not found
Firefox can't find the server at game-cam.everythingwitty.com.
witty
05-09-2007, 02:41 PM
Hi,
Hmm... that's weird. It's definitely up and running.
-Witty
Dennis
05-09-2007, 03:12 PM
Well, I still can't get on your blog. That makes it hard for me to grab a picture so I can test it in my development area.
witty
05-09-2007, 04:42 PM
Hi,
My guess it's my APF installation... which I've disabled for the time being. Try that (please). The very first image should be a good one for your testing. Thanks!
-Witty
Dennis
05-10-2007, 05:21 AM
Yes, indeed it was. I'll have taken down some of your pictures and will look at it later today.
witty
05-10-2007, 02:03 PM
Hi,
Thanks schonhose. Please keep in mind that a few of the images on my site are scans of 35mm pictures (they have thick black borders across the bottom of the image), so obviously their exif data will fail no matter what... and I'm fine with that. In case you grabbed one of those, I just wanted to let you know so they wouldn't confuse the situation. Thanks!
-Witty
Dennis
05-10-2007, 04:59 PM
Camerafabrikant: SONY
Cameramodel: DSC-P32
Belichting: 1/60 sec
Diafragma: f 2.8
Brandpuntsafstand: 5 mm
ISO: 400
Opnamedatum: Mar 28, 2007 - 07:39
Flitser: Uit
This is what I see when uploading the squirrel picture. So either I explained it wrong, or you implemented it wrong ;)
witty
05-10-2007, 07:00 PM
Hi,
Well, that's good news, but still not working for me. I downloaded a "fresh" copy of functions_exif.php, then added:
function replace_exif_tags ($language_full, $image_exif, $tpl)
{
global $cfgrow;
And replaced the $capture_date line as suggested. But I'm getting the same results. I'll dig a little deeper.
-Witty
Dennis
05-16-2007, 04:27 PM
Ok, open functions_exif.php, goto line 77 (or nearby) where the $capture_date statement is.
Replace that line with:
$exif_result['DateTimeOriginalSubIFD'] = trim(str_replace('-',':',$exif_result['DateTimeOriginalSubIFD']));
$exif_result['DateTimeOriginalSubIFD'] = str_replace(' ',':',$exif_result['DateTimeOriginalSubIFD']);
$ftime = explode(":", $exif_result['DateTimeOriginalSubIFD']);
$unxTimestamp = mktime($ftime[3],$ftime[4],$ftime[5],$ftime[1],$ftime[2],$ftime[0]);
$capture_date = date($cfgrow['dateformat'],$unxTimestamp);
witty
05-16-2007, 05:21 PM
Hi,
Thanks schonhose... works perfectly.
-Witty
I now use version 1.6 of PP and I'd be very interested to know how to modify PP to have exif date like your's.
Thanks,
Dennis
05-25-2007, 04:49 AM
Well read about three posts up and voila, there it is.
quilmore
08-27-2007, 09:06 PM
Ok, open functions_exif.php, goto line 77 (or nearby) where the $capture_date statement is.
Replace that line with:
$exif_result['DateTimeOriginalSubIFD'] = trim(str_replace('-',':',$exif_result['DateTimeOriginalSubIFD']));
$exif_result['DateTimeOriginalSubIFD'] = str_replace(' ',':',$exif_result['DateTimeOriginalSubIFD']);
$ftime = explode(":", $exif_result['DateTimeOriginalSubIFD']);
$unxTimestamp = mktime($ftime[3],$ftime[4],$ftime[5],$ftime[1],$ftime[2],$ftime[0]);
$capture_date = date($cfgrow['dateformat'],$unxTimestamp);
if I do as you recomended my date and time disappears
what I'm missing? something or some variables should be added somewherelese?
thanks for all support
Zenigata
09-03-2007, 01:31 AM
if I do as you recomended my date and time disappears
what I'm missing? something or some variables should be added somewherelese?
thanks for all support
Yes:
Go to the function replace_exif_tags ($language_full, $image_exif, $tpl). Place the following line right after the {
global $cfgrow;
witty
06-08-2008, 08:56 PM
Hi,
I was curious if someone could tell me how these instructions may need to be changed to be compatible with version 1.7. Perhaps we can make this an add-on... "Pretty Date Format"? :)
-Witty
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.