I'm developing an image processor script to basically resize images. The problem is that when I make the resized copy of the image, it doesn't copy the IPTC data as well. So I've been checking the IPTC PHP functions (iptcparse and iptcembed) but I'm quite confused. Using iptcparse is very simple. It gets all the data into an array and then I print it out with print_r. But the supposedly useful one is iptcembed because it allows you to (as the name says) embed IPTC on your images. Watching the example from php.net I don't quite get it. Do I have to create my array manually in order to embed it on the new image. I guess there's an easy way to just copy one images IPTC's data and embed it into other image.
Any answer will be welcome. Thanks in advance.
I think, this is quite simple. To get the iptc data from the old image, you just have to use the getimagesize and iptcparse functions.
On php.net you found this example to reach this
<?php
$size = getimagesize('./test.jpg', $info);
if(isset($info['APP13']))
{
$iptc = iptcparse($info['APP13']);
var_dump($iptc);
}
?>
Combine this sample with the iptcembed method and you have everything you need
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With