Same name and namespace in other branches
- 8.x-1.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::readIptcTags() 1 comment
- 8.x-2.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::readIptcTags() 1 comment
Read IPTC tags.
Parameters
string $file: Path to image to read IPTC from.
bool $enable_sections:
Return value
array
1 call to ExifPHPExtension::readIPTCTags()
- ExifPHPExtension::readMetadataTags in ./
ExifPHPExtension.php - List of options for the method.
File
-
./
ExifPHPExtension.php, line 383
Class
- ExifPHPExtension
- This is a helper class to handle the whole data processing of exif.
Namespace
Drupal\exifCode
public function readIPTCTags($file, $enable_sections) {
$humanReadableKey = $this->getHumanReadableIPTCkey();
$infoImage = array();
$size = getimagesize($file, $infoImage);
$iptc = empty($infoImage["APP13"]) ? array() : iptcparse($infoImage["APP13"]);
$arSmallIPTC = array();
if (is_array($iptc)) {
foreach ($iptc as $key => $value) {
if (count($value) == 1) {
$resultTag = $value[0];
}
else {
$resultTag = $value;
}
if (array_key_exists($key, $humanReadableKey)) {
$humanKey = $humanReadableKey[$key];
$arSmallIPTC[$humanKey] = $resultTag;
}
else {
$arSmallIPTC[$key] = $resultTag;
}
}
}
if ($enable_sections) {
return array(
'iptc' => $arSmallIPTC,
);
}
else {
return $arSmallIPTC;
}
}