Title: DateTimeOriginal char corruption
Last modified: August 31, 2016

---

# DateTimeOriginal char corruption

 *  Resolved [Rufus McDufus](https://wordpress.org/support/users/rufus-mcdufus/)
 * (@rufus-mcdufus)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/)
 * Hi, I have a problem using exif:DateTimeOriginal in a Content Template. I have
   a bunch of jpeg images all originating from the same camera, all edited and converted
   to jpeg at the same time. I’m using [+exif:DateTimeOriginal,date(‘F j, Y’)+] 
   to pull the date taken from each image. Most images are fine but one or two will
   have a weird character in place of the date, and a few have today’s date instead
   of the taken date. The faulty images appear fine in Bridge or from the exif command
   line tool. I’ve tried a few variants on DateTimeOriginal, no filters and raw 
   and with no luck.
    The workaround is to simply save the faulty image again (not
   ideal as it’s recompressing a jpeg but good enough for web use) and this usually
   fixes it. If it doesn’t then a second ‘save as’ usually does the trick!
 * I’ve tried different base file names, varying the IPTC description/title I have
   in there (it doesn’t appear to be being caused by weird characters somewhere 
   upstream as far as I can see). It only happens with exif:DateTimeOriginal. Other
   substitution fields are fine. This is the full Content Template I’m using to 
   generate a title. I’ve cut it down to just [+exif:DateTimeOriginal+] on it’s 
   own – no joy.
 * template:[+terms:attachment_category+] – ([+iptc:caption-or-abstract+] – )[+exif:
   DateTimeOriginal,date(‘F j, Y’)+]
 * [https://wordpress.org/plugins/media-library-assistant/](https://wordpress.org/plugins/media-library-assistant/)

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

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425120)
 * Thanks for the question with all the details you included and the various experiments
   you’ve tried. I have worked with many damaged image files over the years and 
   it doesn’t surprise me that re-saving the file cleans it up; Adobe products rewrite
   the metadata when they save the file and they’ve seen more damaged files than
   I ever will.
 * It would be great if you could post a link to one or more of the damaged files
   so I can try to reproduce the problem and investigate further. If you’d rather
   send files by email, give me your contact information I will reply with an address
   you can use to send them. You can use the Contact Us page at our web site:
 * [Fair Trade Judaica/Contact Us](http://fairtradejudaica.org/our-story/contact-us/)
 * Do not post your e-mail address in the forum; personal details in a public forum
   violates WordPress guidelines. I look forward to getting some samples to work
   with.
 *  Thread Starter [Rufus McDufus](https://wordpress.org/support/users/rufus-mcdufus/)
 * (@rufus-mcdufus)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425136)
 * Many thanks David! Message sent.
 *  Thread Starter [Rufus McDufus](https://wordpress.org/support/users/rufus-mcdufus/)
 * (@rufus-mcdufus)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425178)
 * OK, it turns out the exif data for my images (captured from a Canon EOS400D or
   5D mk III) all seem to be slightly corrupt. Even images with good DateTimeOriginal
   values have bad values elsewhere. I did a little digging and it looks like PHP’s
   exif_read_data() function is returning bad data. No idea why because other tools
   including Adobe Bridge, exiftool, and exif seem to return good data. Weird. The
   PHP version is update to date in terms of packages available (Debian) but it 
   does look like exif_read_data() doesn’t change too often.
 * Anyhow David suggested using xmp:CreateDate instead and this works perfectly!
   That’ll teach me to RTFM too – there are so many values available.
 *  Thread Starter [Rufus McDufus](https://wordpress.org/support/users/rufus-mcdufus/)
 * (@rufus-mcdufus)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425186)
 * I found the underlying reason. The problem was a metadata template in Adobe Bridge
   was being applied, but that template had the DateTimeOriginal field ticked (but
   no value given). The field was getting stomped over when the metadata template
   was applied. Strange it didn’t happen for all images, and strange only the PHP
   exif_read_data() function had trouble with it and not other tools, but hey.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425292)
 * I have uploaded a new MLA Development Version dated 20160601 that replaces damaged
   EXIF DateTimeOriginal values with XMP CreateDate values when they are available.
   This repairs the damage in the example images you provided.
 * Thanks for inspiring this MLA enhancement and for helping me test it.
 *  Thread Starter [Rufus McDufus](https://wordpress.org/support/users/rufus-mcdufus/)
 * (@rufus-mcdufus)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425300)
 * Terrific – thank you so much!

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

The topic ‘DateTimeOriginal char corruption’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Rufus McDufus](https://wordpress.org/support/users/rufus-mcdufus/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/datetimeoriginal-char-corruption/#post-7425300)
 * Status: resolved