Esempio n. 1
0
 /**
  * Loads an image from file
  *
  * @access  public
  * @param   string  $filename   Name of file
  * @param   bool    $readonly   Don't any change on image
  * @return  mixed   True if success or a Jaws_Error object on error
  */
 function load($filename, $readonly = false)
 {
     $result = parent::load($filename, $readonly);
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     if (!$readonly) {
         $this->_hImage = new Imagick();
         try {
             $this->_hImage->readImage($filename);
         } catch (ImagickException $error) {
             return Jaws_Error::raiseError('Could not load image: ' . $error->getMessage(), __FUNCTION__);
         }
     }
     return true;
 }
Esempio n. 2
0
 /**
  * Loads an image from file
  *
  * @access  public
  * @param   string  $filename
  * @param   bool    $readonly readonly
  * @return  mixed   True if success or a Jaws_Error object on error
  */
 function load($filename, $readonly = false)
 {
     $result = parent::load($filename, $readonly);
     if (Jaws_Error::IsError($result)) {
         return $result;
     }
     if (!$readonly) {
         $funcName = 'imagecreatefrom' . $this->_itype;
         $this->_hImage = $funcName($filename);
         if (!$this->_hImage) {
             $this->_hImage = null;
             return Jaws_Error::raiseError('Error while loading image file.', __FUNCTION__);
         }
     }
     return true;
 }