[英]How to parse keyword IPTC from image using PHP?
I have image with keyword. 我有带关键字的图片。 I can not extract keywords using IPTC.
我无法使用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/ @kuslahne请检查我的库: 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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.