Example #1
0
 public function __construct($image_types = array(), Router $router)
 {
     if (is_array($image_types)) {
         $this->image_types = array_merge($this->image_types, $image_types);
     }
     $this->router = $router;
     $this->imagine = extension_loaded('imagick') ? new Imagine() : new \Imagine\Gd\Imagine();
     $this->imagine->setMetadataReader(new ExifMetadataReader());
 }
Example #2
0
 /**
  * Return EXIF metadata for a file by it's path
  *
  * @param $filePath
  *
  * @return array
  */
 public function getExifMetadata($filePath)
 {
     try {
         $exifReader = new \Imagine\Image\Metadata\ExifMetadataReader();
         $this->_instance->setMetadataReader($exifReader);
         $exif = $this->_instance->open($filePath)->metadata();
         return $exif->toArray();
     } catch (\Imagine\Exception\NotSupportedException $exception) {
         Craft::log($exception->getMessage(), LogLevel::Error);
         return array();
     }
 }