Author Topic: Is "Star Rating" stored in the IPTC metadata  (Read 5611 times)

Offline tommygrealy

  • Member
  • **
  • Posts: 53
    • View Profile
Is "Star Rating" stored in the IPTC metadata
« on: January 09, 2013, 07:53:14 AM »
Hi, I am using Photomecanic V5 on MacOS mountain Lion.
Currently, I pull out the IPTC metadata (shown in the PHP code snippet) of every jpeg that I upload to my server. The numbers after the 2# corrispond to the numbers in the IPTC specification found here: [url]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf][url]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf[/url]

I was wondering if Photomechanic actually stores the "star rating" in an IPTC or Exif feild and if so. How I would access it. I am currently accessing the other fields using PHP as below: 

Code: [Select]
                $caption = $iptc["2#120"][0];
                $city = $iptc["2#090"][0];
                $transmission_ref = $iptc["2#103"][0];
                $location = $iptc["2#092"][0];
                $country = $iptc["2#101"][0];
                $special_instructions = $iptc["2#040"][0];
                $img_width = $exif["COMPUTED"]["Width"];
                $img_height = $exif["COMPUTED"]["Height"];

Please let me know if there is a way to reference the star rating that I set in PM in the same way as I access the other IPTC/EXIF feilds.

Thanks
-Tommy

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24730
    • View Profile
    • Camera Bits, Inc.
Re: Is "Star Rating" stored in the IPTC metadata
« Reply #1 on: January 09, 2013, 09:08:33 AM »
Tommy,

Hi, I am using Photomecanic V5 on MacOS mountain Lion.
Currently, I pull out the IPTC metadata (shown in the PHP code snippet) of every jpeg that I upload to my server. The numbers after the 2# corrispond to the numbers in the IPTC specification found here: [url=http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf][url]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf][url]http://www.iptc.org/std/photometadata/documentation/IPTC-CS5-FileInfo-UserGuide_6.pdf[/url]

I was wondering if Photomechanic actually stores the "star rating" in an IPTC or Exif feild and if so. How I would access it. I am currently accessing the other fields using PHP as below: 

Code: [Select]
                $caption = $iptc["2#120"][0];
                $city = $iptc["2#090"][0];
                $transmission_ref = $iptc["2#103"][0];
                $location = $iptc["2#092"][0];
                $country = $iptc["2#101"][0];
                $special_instructions = $iptc["2#040"][0];
                $img_width = $exif["COMPUTED"]["Width"];
                $img_height = $exif["COMPUTED"]["Height"];

Please let me know if there is a way to reference the star rating that I set in PM in the same way as I access the other IPTC/EXIF feilds.

Are you also able to access XMP?  If so, then the "Rating" tag would be in the "http://ns.adobe.com/xap/1.0/" namespace.

Otherwise you could access $iptc["2#221"] to get the PM Prefs field.  It is in the following format:

TAG:COLOR_CLASS:RATING:FRAME

TAG is either 0 or 1.
COLOR_CLASS is 0 through 8
RATING is 0 through 5
FRAME is either -1 for no value, or 0 through 9999

HTH,

-Kirk

Offline tommygrealy

  • Member
  • **
  • Posts: 53
    • View Profile
Re: Is "Star Rating" stored in the IPTC metadata
« Reply #2 on: January 09, 2013, 12:12:49 PM »
That's great, thanks Kirk. I actually am already picking up 2#221 in my script but didn't realise that's what it was. I can parse out the star rating from that string.

2#221: [
"1:0:0:007836"
]
« Last Edit: January 09, 2013, 12:14:31 PM by tommygrealy »