【发布时间】:2010-09-06 16:05:33
【问题描述】:
我正在尝试使用 iptcembed() 将 IPTC 数据嵌入到 JPEG 图像中,但遇到了一些麻烦。
我已经验证它在最终产品中:
// Embed the IPTC data
$content = iptcembed($data, $path);
// Verify IPTC data is in the end image
$iptc = iptcparse($content);
var_dump($iptc);
返回输入的标签。
但是,当我保存并重新加载图像时,标签不存在:
// Save the edited image
$im = imagecreatefromstring($content);
imagejpeg($im, 'phplogo-edited.jpg');
imagedestroy($im);
// Get data from the saved image
$image = getimagesize('./phplogo-edited.jpg');
// If APP13/IPTC data exists output it
if(isset($image['APP13']))
{
$iptc = iptcparse($image['APP13']);
print_r($iptc);
}
else
{
// Otherwise tell us what the image *does* contain
// SO: This is what's happening
print_r($image);
}
那么为什么保存的图像中没有标签?
PHP源码为avaliable here,分别输出为:
【问题讨论】: