1

I have a small PHP script that grabs specific IPTC tags from an image file after uploading (see below):

move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/' . $_FILES['file']['name']);

$size = getimagesize('uploads/' . $_FILES['file']['name'], $info);

if(isset($info['APP13'])) { $iptc = iptcparse($info['APP13']); }

$title = $iptc["2#005"][0];
$artist = $iptc["2#025"][0];
$medium = $iptc["2#120"][0];
$date = $iptc["2#092"][0];
$credit = $iptc["2#080"][0];
$subject = $iptc["?????"][0];

All is well - except I can't for the life of me find the equivalent HEX value for the SubjectCode field! The IPTC reference documents list the value as "0x020C" - but that doesn't work. It's ID value is "2:12" according to the Adobe XMP docs. I'm stumped. Any gurus out there that can point me in the right direction?

Oroonoko
  • 11
  • 1
  • Have you made a var_dump of $iptc to check what it contains? – 04FS Nov 12 '19 at 11:48
  • 1
    There's a graphy manual http://phpgraphy.sourceforge.net/manual/latest/apas04.html but for some reason those doesn't seem to match your codes. can you at least provide the file you're uploading so we can reproduce your result? – Jan Myszkier Nov 12 '19 at 11:59
  • Thanks for the replies. Using https://getpmd.iptc.org/ I can see that the file (http://defiancegallery.com/fresh/uploads/image.jpg) has data against the tag (Subject Code (XMP)). Part of the problem might be that it's under 'XMP - IPTC Photo Metadata Fields'? – Oroonoko Nov 12 '19 at 21:45
  • PS. Ignore my variable names in the code given - they match what the photographer has put in the respective fields, not what the fields are usually intended for. Except the mystery $subject (Subject Code) that is - which is hiding the dimensions of the artworks being photographed. – Oroonoko Nov 12 '19 at 21:49
  • Found an alternative method using JavaScript String search() Method, reading the image as a text (readAsText). That gives me access to the whole file. I then use split() method to remove the tags. Probably inefficient but seems to work. – Oroonoko Nov 13 '19 at 02:39

0 Answers0