我试图从图像的exif数据中提取'标题'、'标题'和'关键字',好让我可以登录到数据库。我需要的其他字段,如文件名、图像尺寸等,很容易找到和提取,但这三个字段是一个问题。我可以看到数据在['IFD0'][' extensietadataplatform ']字段中,并且与许多其他数据混合在一起。我在元数据的标题和标题的开头和结尾添加了'==',以便使用这个'独一'字符组合来搜索和分割字符串。问题是extensietadataplatform字段比显示在屏幕上的要大得多。echo后的屏幕数据长度约为270个字符,而strlen($my_string)的长度为12,075个字符。当使用字符串函数来删除我需要的数据时,这会导致不可预测的结果。有谁知道为什么会这样,或者有什么更容易的方法来获得我需要的信息吗?我看到过对“$iptc = iptcparse($info['APP13'])”的引用,但是我的exif数据中似乎没有'APP13'。我使用Lightroom来输入标题、说明和关键字。
if (isset($exif['IFD0']['ExtensibleMetadataPlatform']))
{
$cap_key_title = $exif['IFD0']['ExtensibleMetadataPlatform'];
echo 'cap_key_title is... '.$cap_key_title.'<p>';
// Below is a typical result of the line above, this is about 270 odd characters
// Phillip Biggs ==Broken sunlight on the fell== ©Phillip Biggs Lake District National Park Serene ==A restful quiet corner of Cumbria.== Licensed useages only 0, 0 255, 255 0, 0 255, 255 0, 0 255, 255 0, 0 255, 255 0, 0 255, 255 0, 0 255, 255 0, 0 255, 255 0, 0 255, 255
echo 'length of string is... '.strlen($cap_key_title).'<p>'; // Produces a value around 12,071 characters.
$title = stristr($cap_key_title,"Biggs"); // Cut off up to the string 'Biggs'
echo 'All the data now shown... '.$title.'<p>'; // Now we can see all the other data previously hidden
}
最后一个echo语句的SHORT部分在这里。 Biggs“ photoshop:DateCreated =” 2006-10-03“ photoshop:Source =” www.imagefair.co.uk或www.flick“ photoshop:TransmissionReference =”已进入2017 BJ第三轮景观。 首先放置。“ photoshop:State =” Cumbria“ photoshop:Country =”英格兰“ xmp:CreateDate =” 2006-10-03T13:32:47“ xmp:CreatorTool =” Adobe Photoshop Lightroom 5.7(Windows)“ xmp:Label = “在imagefair和club上使用” xmp:MetadataDate =“ 2019-05-27T00:19:02 + 01:00” xmp:ModifyDate =“ 2019-05-27T00:19:02 + 01:00” xmpMM:DocumentID =“ xmp.did:ed6b23db-7708-6444-922d