1

I have been working on storing metadata in images with varying success. I have been able to add most of the fields I need but have hit some inexplicable difficulties. This code works for the first 5 adds but the DateTimeOriginal is not being added. No errors pop up it just simply does not appear in the resulting metadata.

function setMetadata(PelIfd $ifd, array $tags)
{
  $ifd->addEntry(new PelEntryAscii(PelTag::XP_AUTHOR, $tags['Author']));
  $ifd->addEntry(new PelEntryAscii(PelTag::XP_COMMENT, $tags['Comments']));
  $ifd->addEntry(new PelEntryAscii(PelTag::XP_KEYWORDS, $tags['Keywords']));
  $ifd->addEntry(new PelEntryAscii(PelTag::XP_SUBJECT, $tags['Subject']));
  $ifd->addEntry(new PelEntryAscii(PelTag::XP_TITLE, $tags['Title']));
  $ifd->addEntry(new PelEntryTime(PelTag::DATE_TIME_ORIGINAL, $tags['DateTimeOriginal']));
}
Drakes
  • 23,254
  • 3
  • 51
  • 94
chrisgotter
  • 383
  • 1
  • 3
  • 13
  • what value is in the DateTimeOriginal? The docs indicate the timestamp should be a unix timestamp, e.g. a signed integer. – Marc B Mar 31 '15 at 21:57
  • I tried entering an integer value with no effect – chrisgotter Mar 31 '15 at 22:07
  • 2
    Figured it out. This is a great tool but extremely difficult to figure out. $ex = new PelIfd(PelIfd::EXIF); $ifd->addSubIfd($ex); $ex->addEntry(new PelEntryTime(PelTag::DATE_TIME_ORIGINAL, $tags['DateTimeOriginal'])); – chrisgotter Apr 04 '15 at 04:13

0 Answers0