I have image with keyword. I can not extract keywords using IPTC. Did somebody found a way to retrieve the keyword phrases? How to approach the result? This code i found somewhere on forum.
<?php function output_iptc_data( $image_path ) {
$size = getimagesize ( $image_path, $info);
if(is_array($info)) {
$iptc = iptcparse($info["APP13"]);
foreach (array_keys($iptc) as $s) {
$c = count ($iptc[$s]);
for ($i=0; $i <$c; $i++)
{
echo $s.' = '.$iptc[$s][$i].'<br>';
}
}
} } output_iptc_data('IMGP4053m.jpg'); ?>
@kuslahne please check my library: https://ibudasov.github.io/php7-iptc-manager/
Seems like it does everything you need.
// import the Manager class
use iBudasov\Iptc\Manager;
// ... and instantiate it!
$manager = Manager::create();
$manager->loadFile('./IMGP4053m.jpg');
$allTheTagsInTheImage = $manager->getTags();