Example #1
0
 /**
  * Class Constructor
  * 
  * @return 
  * @param string $fileName
  */
 public function __construct($fileName, $options = array(), $isDataStream = false)
 {
     parent::__construct($fileName, $isDataStream);
     $this->determineFormat();
     /* TODO Compatibility COntrol
     		 * if ($this->isDataStream === false)
     		{
     			$this->verifyFormatCompatiblity();
     		}*/
     $this->oldImage = new JO_Phpthumb_Factory_Imagick_Phmagick($fileName);
     $this->workingImage = new JO_Phpthumb_Factory_Imagick_Phmagick($fileName);
     $this->workingImage->setImageQuality($this->options['jpegQuality']);
     list($w, $h) = $this->oldImage->getInfo($this->oldImage->getSource());
     $this->currentDimensions = array('width' => $w, 'height' => $h);
     $this->setOptions($options);
 }
Example #2
0
 /**
  * Class Constructor
  * 
  * @return JO_Phpthumb_Factory_Gd 
  * @param string $fileName
  */
 public function __construct($fileName, $options = array(), $isDataStream = false)
 {
     parent::__construct($fileName, $isDataStream);
     $this->determineFormat();
     if ($this->isDataStream === false) {
         $this->verifyFormatCompatiblity();
     }
     switch ($this->format) {
         case 'GIF':
             $this->oldImage = imagecreatefromgif($this->fileName);
             break;
         case 'JPG':
             $this->oldImage = imagecreatefromjpeg($this->fileName);
             break;
         case 'PNG':
             $this->oldImage = imagecreatefrompng($this->fileName);
             break;
         case 'STRING':
             $this->oldImage = imagecreatefromstring($this->fileName);
             break;
     }
     $this->currentDimensions = array('width' => imagesx($this->oldImage), 'height' => imagesy($this->oldImage));
     $this->setOptions($options);
     // TODO: Port gatherImageMeta to a separate function that can be called to extract exif data
 }