예제 #1
0
파일: Imagick.php 프로젝트: Dulciane/jaws
 /**
  * Loads an image from raw data
  *
  * @access  public
  * @param   string  $data       Image raw data
  * @param   bool    $readonly   Don't any change on image
  * @return  mixed   True if success or a Jaws_Error object on error
  */
 function setData($data, $readonly = false)
 {
     $result = parent::setData($data, $readonly);
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     if (!$readonly) {
         $this->_hImage = new Imagick();
         try {
             $this->_hImage->readImageBlob($data);
         } catch (ImagickException $error) {
             return Jaws_Error::raiseError('Could not load image from string: ' . $error->getMessage(), __FUNCTION__);
         }
     }
     return true;
 }
예제 #2
0
파일: GD.php 프로젝트: juniortux/jaws
 /**
  * Loads an image from raw data
  *
  * @access  public
  * @param   string  $data       Image raw data
  * @param   bool    $readonly   Readonly
  * @return  mixed   True if success or a Jaws_Error object on error
  */
 function setData($data, $readonly = false)
 {
     $result = parent::setData($data, $readonly);
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     if (!$readonly) {
         $this->_hImage = imagecreatefromstring($data);
         if (!$this->_hImage) {
             $this->_hImage = null;
             return Jaws_Error::raiseError('Error while loading image from string.', __FUNCTION__);
         }
     }
     return true;
 }