Файл: system/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php
Строк: 58
<?php
namespace InterventionImageImagickCommands;
use InterventionImageCommandsExifCommand as BaseCommand;
use InterventionImageExceptionNotSupportedException;
class ExifCommand extends BaseCommand
{
/**
* Prefer extension or not
*
* @var bool
*/
private $preferExtension = true;
/**
*
*/
public function dontPreferExtension() {
$this->preferExtension = false;
}
/**
* Read Exif data from the given image
*
* @param InterventionImageImage $image
* @return boolean
*/
public function execute($image)
{
if ($this->preferExtension && function_exists('exif_read_data')) {
return parent::execute($image);
}
$core = $image->getCore();
if ( ! method_exists($core, 'getImageProperties')) {
throw new NotSupportedException(
"Reading Exif data is not supported by this PHP installation."
);
}
$requestedKey = $this->argument(0)->value();
if ($requestedKey !== null) {
$this->setOutput($core->getImageProperty('exif:' . $requestedKey));
return true;
}
$exif = [];
$properties = $core->getImageProperties();
foreach ($properties as $key => $value) {
if (substr($key, 0, 5) !== 'exif:') {
continue;
}
$exif[substr($key, 5)] = $value;
}
$this->setOutput($exif);
return true;
}
}