loadFile() public méthode

Loads the image data from a file.
public loadFile ( string $filename )
$filename string The full path and filename to the file to load the image data from.
Exemple #1
0
 /**
  * Load the image data from a file.
  *
  * @param string $filename  The full path and filename to the file to load
  *                          the image data from. The filename will also be
  *                          used for the image id.
  *
  * @return mixed
  */
 public function loadFile($filename)
 {
     // parent function loads image data into $this->_data
     parent::loadFile($filename);
     $this->_imagick->clear();
     try {
         $this->_imagick->readImageBlob($this->_data);
         $this->_imagick->setImageFormat($this->_type);
         $this->_imagick->setIteratorIndex(0);
     } catch (ImagickException $e) {
         throw new Horde_Image_Exception($e);
     }
     unset($this->_data);
 }
Exemple #2
0
 /**
  * Load the image data from a file.
  *
  * @param string $filename  The full path and filename to the file to load
  *                          the image data from. The filename will also be
  *                          used for the image id.
  *
  * @return boolean
  * @throws Horde_Image_Exception
  */
 public function loadFile($filename)
 {
     $info = $this->call('getimagesize', array($filename));
     if (is_array($info)) {
         switch ($info[2]) {
             case 1:
                 if (function_exists('imagecreatefromgif')) {
                     $this->_im = $this->call('imagecreatefromgif', array($filename));
                 }
                 break;
             case 2:
                 $this->_im = $this->call('imagecreatefromjpeg', array($filename));
                 break;
             case 3:
                 $this->_im = $this->call('imagecreatefrompng', array($filename));
                 break;
             case 15:
                 if (function_exists('imagecreatefromgwbmp')) {
                     $this->_im = $this->call('imagecreatefromgwbmp', array($filename));
                 }
                 break;
             case 16:
                 $this->_im = $this->call('imagecreatefromxbm', array($filename));
                 break;
         }
     }
     if (is_resource($this->_im)) {
         return true;
     }
     $result = parent::loadFile($filename);
     $this->_im = $this->call('imageCreateFromString', array($this->_data));
 }
Exemple #3
0
 /**
  * Loads the image data from a file.
  *
  * @param string $filename  The full path and filename to the file to load
  *                          the image data from.
  *
  * @throws Horde_Image_Exception
  */
 public function loadFile($filename)
 {
     // Parent function loads image data into $this->_data
     parent::loadFile($filename);
     $this->loadString($this->_data);
 }
Exemple #4
0
 /**
  * Loads the image data from a file.
  *
  * @param string $filename  The full path and filename to the file to load
  *                          the image data from.
  */
 public function loadFile($filename)
 {
     $info = $this->call('getimagesize', array($filename));
     if (is_array($info)) {
         switch ($info[2]) {
             case IMAGETYPE_GIF:
                 if (function_exists('imagecreatefromgif')) {
                     $this->_im = $this->call('imagecreatefromgif', array($filename));
                 }
                 break;
             case IMAGETYPE_JPEG:
                 $this->_im = $this->call('imagecreatefromjpeg', array($filename));
                 break;
             case IMAGETYPE_PNG:
                 $this->_im = $this->call('imagecreatefrompng', array($filename));
                 break;
             case IMAGETYPE_WBMP:
                 if (function_exists('imagecreatefromgwbmp')) {
                     $this->_im = $this->call('imagecreatefromgwbmp', array($filename));
                 }
                 break;
             case IMAGETYPE_XBM:
                 $this->_im = $this->call('imagecreatefromxbm', array($filename));
                 break;
         }
     }
     if (is_resource($this->_im)) {
         return;
     }
     parent::loadFile($filename);
     $this->_im = $this->call('imageCreateFromString', array($this->_data));
 }