WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Plugin claims all pictures were taken on 1 January 1970

[Resolved] Plugin claims all pictures were taken on 1 January 1970

  • We take pictures by several cameras and then organize them by date and time. Until now, it was ok, everything worked perfectly.

    I tried to add another album two days ago and I couldn´t do it. Date next to every thumbnail is 1 January 1970, although in metainfo is the correct date and time. Now there are first all the pictures from camera 1, then all the pictures from camera 2 aso. What can I do?

    http://wordpress.org/extend/plugins/nextgen-gallery/

Viewing 15 replies - 1 through 15 (of 16 total)
  • I was puzzled by this strange behaviour too. Honestly, after NextGenGallery was sold, it’s not getting better.
    I did some digging and testing. Turned out, it’s function get_date_time() in meta.php (wp-content/plugins/nextgen-gallery/lib/meta.php).

    This particular function tries to find image creation date by looping through several EXIF fields. It’s all right and proper, but what does it do then? Calls this function on line 522 (that’s approximate location, for my version of plugin):

    // Return the MySQL format
    $date_time = date( ‘Y-m-d H:i:s’, $date_time );

    I really wonder what kind of conversion that was meant to be. Second argument of “date” function was always epoch seconds – and here it gets “normal” Y-M-D H:M:S value. Of course it gets converted into 1970 date. No wonder.

    After I commented out that line, everything started working as it should. Hope it will save someone the frustration.

    BTW, after that correction you can simply check all images and select “import metadata” from bulk operation dropdown. That will correct the dates.

    You’re right about where there is a problem but you correction doesn’t work, at the end every picture will use the upload date. Instead the get_date_time must be corrected as follow:

    $date_time = false;
    
    // get exif - data
    if ( isset( $this->exif_data['EXIF']) ) {
    
        // try to read the date / time from the exif
        foreach (array('DateTimeDigitized', 'DateTimeOriginal', 'FileDateTime') as $key) {
            if (isset($this->exif_data['EXIF'][$key])) {
                $date_time = $this->exif_data['EXIF'][$key];
            }
        }
    
        if ($date_time) $date_time = $this->exif_date2ts($date_time);
    }
    
    if (!$date_time) {
        // if no other date available, get the filetime
        $date_time = @filectime($this->image->imagePath );
    }
    
    // Return the MySQL format
    $date_time = date( 'Y-m-d H:i:s', $date_time );
    
    return $date_time;

    This did not work for me. Making this change to the meta.php file and selecting the images and importing metadata resulted in the dates for the images changing to the upload date, not the date the photo was actually taken. Even deleting the images and re-uploading them changed nothing.

    Strange, it worked for me – thanks Claude Vedovini!

    Plugin Author photocrati

    @photocrati

    Hey everyone,

    We’re very sorry about this bug, and want to let you know we’re currently wrapping up an update to the plugin that will include a fix for this. I am going to mark this thread as resolved, I hope that’s OK. We hope to have that update available sometime this week.

    Thanks!
    -Becky

    Hi photocrati

    When this fix is implemented , should be it will be neccesary “import metadata” in the affected photos or the problem will solve alone without do nothing?

    This is because in some photos, when I import metadata I deleted all the info of the picture and I get the original info when I uploaded 🙁

    Thxs

    Regards

    Plugin Author photocrati

    @photocrati

    @alfredo49 – that may be related, I personally haven’t seen that happen on my own sites. But I’ll pass along your report to the developers and we’ll check that out before we release v1.9.13

    Thanks!
    –Becky

    Hi photocrati,

    I currently develop a new version of my website and I try NextGen Gallery for the first time (I do really enjoy it!) and … I also have this bug: all of my pictures are shown at 01/01/1970, wherever they come from (directly from camera, from scanner, after work in Photoshop or in Lightroom) and whatever are the metadatas, if there are some or not…

    I only keep EXIF metadatas (if there are), I don’t keep IPTC or XMP.

    By the way, NextGen admin shows the right Metas (and then the right picture Date/Time) when I ask for it in any gallery list.

    I just tried Claude’s fix and it works for me, both for newly uploaded picts and by re-importing metadatas for existing picts… The workaround is the expected one: EXIF Date if there is, uploaded file date if not.

    So I post here to keep track of this bug 😉

    Regards,
    Johan

    Any news about this bug? it’s really annoying…

    I am looking forward tho the bug fix, too. 🙂

    Plugin Author photocrati

    @photocrati

    Hi everyone,

    We just pushed out the fix for this (NG 1.9.13). I apologize for the delay on the fix. We were planning to push out the fix with 2.0, but that’s obviously been delayed. In retrospect, we should have just pushed this out immediately.

    For images you’ve already uploaded, you can go to the gallery, select images, select “Import Meta” from the drop down, and it should re-import all meta, including the correct dates.

    Please let me know if you continue to have any issues.

    Erick
    (Founder, Photocrati)

    Hi!

    Thxs!

    It seems to works

    Hi,

    works for me, too! Thanks!

    SHC

    Plugin Author photocrati

    @photocrati

    Thanks for letting us know.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] Plugin claims all pictures were taken on 1 January 1970’ is closed to new replies.