Hi, I'm trying to embed comments in jpg images I've created. Here are the read/write functions I've written for the purpose:
function writeJpegComment($imageFile, $comment){
$iptc["2#000"][0] = chr(0) . chr(2);
$iptc["2#120"][0] = $comment; // .. 120 is comment
$imgData = iptcembed($iptc, $imageFile, 0);
$fp = fopen($imageFile, "wb");
fwrite($fp, $imgData);
fclose($fp);
}
function readJpegComment($imageFile){
$size = GetImageSize($imageFile,&$info);
$iptc = iptcparse($info['APP13']);
if (isset ($info["APP13"])) {
$iptc = iptcparse ($info["APP13"]);
if($iptc) return $iptc["2#120"][0];
else echo "Parsing APP13 section failed! \n";
} else echo "No APP13 section found \n";
}
Unfortunately, iptcparse always returns false. Anyone have any idea what's wrong here?