Is it possible to add IPTC metadata support? This would be a terrific feature. All my images are captioned anyway so the info would appear automatically, without the need of entering an additional text file...
|
|||
|
MyWebMyMail.com |
|
|
© Copyright 2005-2012 MyWebMyMail.com. All rights reserved. Disclaimer All posted articles and comments are copyright by their owner, and reflect their own views and opinions, which may not necessarily be consistent with the views and opinions of the owners of MyWebMyMail.com. |
Re:IPTC support
The easy way would be to store all values in an array and then paste the values in the order you would like to have, something like
// Retrieve IPTC caption from jpgfunction iptc($image) {
$caption='';
$fields=array();
$size=@getimagesize($image,$info);
if (isset($info["APP13"])) {
$iptc=@iptcparse($info["APP13"]);
if (is_array($iptc)) {
foreach($iptc as $key=>$section) {
foreach($section as $name=>$val) {
if ($key=='2#120')
$fields[0]=$val;
if ($key=='2#085')
$fields[1]=$val;
}
}
}
}
$caption=$fields[0].''.$fields[1];
return $caption;
}
Re:IPTC support
This is absolutely great! that's what I needed! Any idea how to change the order of appearance in the page? Now the IPTC fields are sorted by the key number ( example '2#085').
For who's interested, this is the code to display most of the IPTC fields. Just delete the line(s) you don't need!
Any idea how to change the order of appearance in the page? Now the IPTC fields are sorted by the key number ( example '2#085').
Replace existing code with this
// Retrieve IPTC caption from jpg
function iptc($image) {
$caption='';
$size=@getimagesize($image,$info);
if (isset($info["APP13"])) {
$iptc=@iptcparse($info["APP13"]);
if (is_array($iptc)) {
foreach($iptc as $key=>$section) {
foreach($section as $name=>$val) {
if ($key == '2#105') $caption.= 'Headline ' .$val . '';
if ($key == '2#085') $caption.= 'Byline Title ' .$val . '';
if ($key == '2#080') $caption.= 'Byline ' .$val . '';
if ($key == '2#115') $caption.= 'Source ' .$val . '';
if ($key == '2#103') $caption.= 'Original Transmission Reference ' .$val . '';
if ($key == '2#040') $caption.= 'Special Instructions ' .$val . '';
if ($key == '2#120') $caption.= 'Caption ' .$val . '';
if ($key == '2#122') $caption.= 'Caption Writer ' .$val . '';
if ($key == '2#116') $caption.= 'Copyright ' .$val . '';
if ($key == '2#110') $caption.= 'Credits ' .$val . '';
if ($key == '2#005') $caption.= 'Object Name ' .$val . '';
if ($key == '2#090') $caption.= 'City ' .$val . '';
if ($key == '2#095') $caption.= 'State ' .$val . '';
if ($key == '2#101') $caption.= 'Country ' .$val . '';
if ($key == '2#015') $caption.= 'Category ' .$val . '';
if ($key == '2#020') $caption.= 'Supplemental Categories ' .$val . '';
if ($key == '2#025') $caption.= 'Keywords ' .$val . '';
if ($key == '2#010') $caption.= 'Urgency ' .$val . '';
}
}
}
}
return $caption;
}
Re:IPTC support
IPTC caption support has been added in version 1.3.1 which has just been released. If you would like to retrieve more IPTC info from the file, it is relatively easy to modify the code, just check the iptc function in the script...