function __construct($image, $isfile = false)
 {
     if ($isfile) {
         $blob = imagick_readimage($image);
         parent::__construct($blob, false);
     } else {
         parent::__construct($image, false);
         $this->data = imagick_blob2image($image);
     }
 }
Beispiel #2
0
 function resizethumb()
 {
     if ($this->thumb !== null) {
         $this->data = imagecreatefromstring($this->thumb);
         $this->loaded = true;
     } else {
         $this->_load_data();
     }
     return parent::resizethumb();
 }
Beispiel #3
0
 function resizethumb()
 {
     if ($this->thumb !== null) {
         $this->data = imagick_blob2image($this->thumb);
         $this->loaded = true;
     } else {
         $this->_load_data();
     }
     if ($this->data) {
         return parent::resizethumb();
     }
 }
 function __construct($image, $isfile = false)
 {
     if ($isfile) {
         $blob = new Imagick();
         $blob->readImage($image);
         parent::__construct($blob, false);
     } else {
         parent::__construct($image, false);
         $this->data = new Imagick();
         $this->data->readImageBlob($image);
     }
 }
 function resizethumb()
 {
     if ($this->thumb !== null) {
         $this->data = new Imagick();
         try {
             $this->data->readImageBlob($this->thumb);
             $this->loaded = true;
         } catch (ImagickException $e) {
             $this->loaded = true;
             $this->data = null;
         }
     } else {
         $this->_load_data();
     }
     if ($this->data) {
         return parent::resizethumb();
     }
 }
Beispiel #6
0
 function __construct($image, $isfile = false)
 {
     parent::__construct($image, false);
     // Which GD Version do we have?
     $exts = get_loaded_extensions();
     if (in_array('gd', $exts) && $image != '') {
         $this->havegd = true;
         $this->get_gdinfo();
         if ($isfile) {
             $this->format = strtolower(substr($image, strrpos($image, '.') + 1));
             if ($this->is_supported($this->format)) {
                 if ($this->format == 'jpg') {
                     $this->format = 'jpeg';
                 }
                 $this->data = call_user_func('imagecreatefrom' . $this->format, $this->data);
             }
         } else {
             $this->data = imagecreatefromstring($this->data);
         }
     } else {
         $this->havegd = false;
         $this->gdinfo = array();
     }
 }
 function icon($extension, $x = 0, $y = 0)
 {
     $keep_original = $x == 0 && $y == 0;
     // This method is not necessarely called through an instance
     $class = isset($this) ? $this->classname : 'Image';
     $format = call_user_func(array($class, 'get_icon_default_format'));
     if (!$keep_original && class_exists($class)) {
         $icon_format = $format;
         $class = 'Image';
         if (call_user_func(array($class, 'is_supported'), 'svg')) {
             $format = 'svg';
         } elseif (call_user_func(array($class, 'is_supported'), 'png')) {
             $format = 'png';
         } else {
             return false;
         }
     }
     $name = "lib/images/icons/{$extension}.{$format}";
     if (!file_exists($name)) {
         $name = "lib/images/icons/unknown.{$format}";
     }
     if (!$keep_original) {
         $icon = new $class($name, true);
         if ($format != $icon_format) {
             $icon->convert($icon_format);
         }
         $icon->resize($x, $y);
         return $icon->display();
     } else {
         return ImageAbstract::get_from_file($name);
     }
 }