Cheetah
ExifCommand.php
Go to the documentation of this file.
1 <?php
2 
4 
6 {
16  public function execute($image)
17  {
18  if ( ! function_exists('exif_read_data')) {
19  throw new \Intervention\Image\Exception\NotSupportedException(
20  "Reading Exif data is not supported by this PHP installation."
21  );
22  }
23 
24  $key = $this->argument(0)->value();
25 
26  // try to read exif data from image file
27  $data = @exif_read_data($image->dirname .'/'. $image->basename);
28 
29  if (! is_null($key) && is_array($data)) {
30  $data = array_key_exists($key, $data) ? $data[$key] : false;
31  }
32 
33  $this->setOutput($data);
34 
35  return true;
36  }
37 }
Intervention\Image\Commands
Definition: AbstractCommand.php:3
php
Intervention\Image\Commands\ExifCommand\execute
execute($image)
Definition: ExifCommand.php:16
Intervention\Image\Commands\AbstractCommand\setOutput
setOutput($value)
Definition: AbstractCommand.php:75
Intervention\Image\Commands\AbstractCommand\argument
argument($key)
Definition: AbstractCommand.php:45
Intervention\Image\Commands\AbstractCommand
Definition: AbstractCommand.php:6
Intervention\Image\Commands\ExifCommand
Definition: ExifCommand.php:6