Пример #1
0
 /**
  * Retrieve image informations
  *
  * @param string $path Image path
  *
  * @return array(
  *  'width',
  *  'height',
  *  'type',
  *  'mime'
  * )
  */
 public function getImageInfos($path)
 {
     $image = new \Gmagick();
     $infos = array();
     try {
         $image->readImage($path);
         $infos[] = $image->getImageWidth();
         $infos[] = $image->getImageHeight();
         $infos[] = $image->getImageFormat();
         $infos[] = null;
         //no way to retrieve mimetype
     } catch (\GmagickException $e) {
         $image->destroy();
         throw new \RuntimeException($e->getMessage());
     }
     $image->destroy();
     return $infos;
 }