Title: Image date problem back?
Last modified: August 21, 2016

---

# Image date problem back?

 *  [OnTrack](https://wordpress.org/support/users/ecomlearning/)
 * (@ecomlearning)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/)
 * Using NGG 2.0.40, Linux server, WP 3.7.1, PHP 5.4.14
 * I am experiencing a recurrence of a bug that we saw in 1.9.x
 * Image dates are set to a mix of the upload date and the meta date.
 * Example:
    Upload an image into an existing gallery. Open the gallery to manage
   the images and examine the “Filename” column. It shows the Title, upload date,
   width x height pixels. Click the meta link for the image and it shows the date/
   time the photo was taken along with all other correct meta, exif, iptc and xmp
   data.
 * The upshot is, when using $image->imagedate, the upload date is returned instead
   of the meta date.
 * I’m not sure how many versions this has been happening for but at least since
   29th October 2013.
    Up until this minor issue NGG version 2 has been working 
   well for me. Images uploaded with older version of NGG 2 are fine, the date is
   displaying as it should.
 * [http://wordpress.org/plugins/nextgen-gallery/](http://wordpress.org/plugins/nextgen-gallery/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Thread Starter [OnTrack](https://wordpress.org/support/users/ecomlearning/)
 * (@ecomlearning)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399585)
 * OK,
    this worked in version 2.0.25, does not work in version 2.0.27 or 2.0.40(
   I have not tested versions between.
 * The file:
    products/photocrati_nextgen/modules/nextgen_data/class.image_mapper.
   php had a minor change on line 61 to 77: [http://plugins.trac.wordpress.org/changeset?reponame=&new=774859%40nextgen-gallery&old=774755%40nextgen-gallery](http://plugins.trac.wordpress.org/changeset?reponame=&new=774859%40nextgen-gallery&old=774755%40nextgen-gallery)
 * Is this a problem with a key in my database or something else?
 * Some hint as to what to check here would be good or I’ll have to just do a dirty
   hack on the code.
 * Cheers.
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399597)
 * [@ecomlearning](https://wordpress.org/support/users/ecomlearning/) – NextGEN 
   Gallery 2.0.40 made significant changes to that particular part of the code, 
   if you wish to review the current code and can offer a suggestion for a correction
   there I will put it right in front of our developers to review.
 * We always welcome constructive criticisms and useful code suggestions or recommendations.
 * Thanks!
 * – Cais.
 *  Thread Starter [OnTrack](https://wordpress.org/support/users/ecomlearning/)
 * (@ecomlearning)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399598)
 * Cais, thanks for the reply.
 * I’m trying to find the bit that broke for me between 2.0.25 and 2.0.27
    To be
   honest, I’m fumbling about a bit with this one. I think I’m just in the wrong
   bit of code but finding the right bit is proving tricky.
 * I’ll happily carry on debugging (I am using the free version after all) but if
   you can point me to the bit of code that sets the date when images are uploaded
   I would really appreciate it.
 * I have found this line in class.image_mapper.php
 *     ```
       // The imagedate must be set
               if ((!isset($entity->imagedate)) OR is_null($entity->imagedate) OR $entity->imagedate == '0000-00-00 00:00:00')
                   $entity->imagedate = date("Y-m-d H:i:s");
       ```
   
 * And have tried changing it so it always sets the date to a static date last year(
   to make it obvious), but uploaded images still get today’s date!
 * Am I missing something obvious?
 * Cheers.
 *  Thread Starter [OnTrack](https://wordpress.org/support/users/ecomlearning/)
 * (@ecomlearning)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399608)
 * Right, for some reason my site seems to be using modules/ngglegacy/lib/meta.php
   when I upload images.
 * What gives?
 * I really am missing something here aren’t I?
    I may just bite the bullet and 
   re-install NGG _sigh_
 *  Thread Starter [OnTrack](https://wordpress.org/support/users/ecomlearning/)
 * (@ecomlearning)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399613)
 * OK,
 * Replace function get_date_time() in 2.0.40 copy of ngglegacy/lib/meta.php with
   copy from 2.0.25 version of ngglegacy/lib/meta.php
 * All is well. Dates are as they should be.
 * This exact function has been broken in the past:
    [http://wordpress.org/support/topic/wrong-meta-data-imported-and-wrong-sorting?replies=50](http://wordpress.org/support/topic/wrong-meta-data-imported-and-wrong-sorting?replies=50)
   You’d think it would work by now wouldn’t you?
 * I have debugged as far as I can and find that inside this function all exif data(
   $this->exif_array) is empty.
    Trace back to where $this->exif_array is populated
   and it is working fine at that point. I don’t know what’s going on, maybe someone
   else does.
 * Point still remains though that my site is using this legacy code instead of 
   the shiny new stuff and I have no idea about that either.
 * Fine, you win, I give up.
 *  [andybrownphotography](https://wordpress.org/support/users/andybrownphotography/)
 * (@andybrownphotography)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399618)
 * I have the exact same problem, the meta data “date taken” is ignored and the 
   upload date is used instead, obviously this causes problems with sorting the 
   gallery by date taken!!
 * Regards,
 * Andy (www.andybrownphotography.co.uk)
 * PS I am running Nextgen Gallery 2.0.40 and WordPress 3.8!!
 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399620)
 * [@ecomlearning](https://wordpress.org/support/users/ecomlearning/) – Wow, that
   is quite extensive troubleshooting and review, thank you very much for all of
   your time with this so far.
 * I’d like to recommend you submit a Bug Report ([http://www.nextgen-gallery.com/report-bug/](http://www.nextgen-gallery.com/report-bug/)…
   please reference this topic) so we can try to help you get this sorted out.
 * We will likely need log in and FTP credentials for the WordPress installation,
   please include those with the Bug Report, too.
 * [@andybrownphotography](https://wordpress.org/support/users/andybrownphotography/)–
   Please feel free to start your own topic as your site’s specific are most likely
   going to be different than the OP.
 * Thanks!
 * – Cais.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Image date problem back?’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [photocrati](https://wordpress.org/support/users/photocrati/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/image-date-problem-back/#post-4399620)
 * Status: not resolved