MicrostockGroup

Microstock Photography Forum - General => Off Topic => Topic started by: RacePhoto on October 24, 2010, 09:06

Title: Display IPTC and/or EXIF under photos on my own website?
Post by: RacePhoto on October 24, 2010, 09:06
I finally got around to hacking out a modification to someone else's Javascript, so I can display the make, model, shutter speed, ISO Etc. Which is fun and proof that it can be done. Eventually it's not that difficult when someone knows the names and how to access it. (not that I did that myself!)

Should you be interested, look at page 160 and 161 for naming convention and calls. This is the EXIF standards document in PDF.

http://dl.dropbox.com/u/8755020/exifStandard.pdf (http://dl.dropbox.com/u/8755020/exifStandard.pdf)

Now the real deal.

Anyone know a way to extract the IPTC data for Description field and Caption (something easy for examples) and have it show under an image, when it displays on my own website. Before I go to all the trouble of finding it for myself, I thought it might just be easier to ask? :D I know it's in there, I just don't know how to access and display it?
Title: Re: Display IPTC and/or EXIF under photos on my own website?
Post by: FD on October 26, 2010, 04:48
Code: [Select]
if(isset($info['APP13'])) {
$iptc = iptcparse($info['APP13']);
if (is_array($iptc)) {
$trtxt = ".,;?!&";
// title
$title = $iptc["2#005"][0];
$title = trim(trim($title),$trtxt);
// description
$description = trim($iptc["2#120"][0]);
$description = trim(trim($description),$trtxt);
// keywords
$lb_keywords = $iptc["2#025"];
if (count($lb_keywords) > 0) {
foreach ($lb_keywords as $key => $value) $lb_keywords[$key] = str_replace('"',"“",str_replace("'","’",trim(trim(strtolower($value)),$trtxt)));
} else {
$lb_keywords[0] = 'No keywords';
};

 :P
Title: Re: Display IPTC and/or EXIF under photos on my own website?
Post by: RacePhoto on October 26, 2010, 20:06
I'll try that one later tonight. I'm playing Buzztime trivia at BWW and it's 45c wing night.

THANKS