Same name and namespace in other branches
- 8.x-1.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::readExifTags() 1 comment
- 8.x-2.x src/ExifPHPExtension.php \Drupal\exif\ExifPHPExtension::readExifTags() 1 comment
Read the Information from a picture according to the fields.
Parameters
string $file:
bool $enable_sections:
Return value
array
1 call to ExifPHPExtension::readExifTags()
- ExifPHPExtension::readMetadataTags in ./
ExifPHPExtension.php - List of options for the method.
File
-
./
ExifPHPExtension.php, line 331
Class
- ExifPHPExtension
- This is a helper class to handle the whole data processing of exif.
Namespace
Drupal\exifCode
public function readExifTags($file, $enable_sections = TRUE) {
$supported_types = array(
'jpg',
'jpeg',
);
if (!in_array(strtolower($this->getFileType($file)), $supported_types)) {
return array();
}
$exif = array();
try {
$exif = @exif_read_data($file, 0, $enable_sections);
} catch (Exception $e) {
watchdog('exif', 'Error while reading EXIF tags from image: !message', array(
'!message' => $e->getMessage(),
), WATCHDOG_WARNING);
}
$arSmallExif = array();
foreach ((array) $exif as $key1 => $value1) {
if (is_array($value1)) {
$value2 = array();
foreach ((array) $value1 as $key3 => $value3) {
$value[strtolower($key3)] = $value3;
}
}
else {
$value = $value1;
}
$arSmallExif[strtolower($key1)] = $value;
}
return $arSmallExif;
}