Horde_Image_Base::loadFile PHP Method

loadFile() public method

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.
    public function loadFile($filename)
    {
        $this->reset();
        if (!file_exists($filename)) {
            throw new Horde_Image_Exception(sprintf("The image file, %s, does not exist.", $filename));
        }
        if (!($this->_data = file_get_contents($filename))) {
            throw new Horde_Image_Exception(sprintf("Could not load the image file %s", $filename));
        }
    }

Usage Example

Example #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);
 }
All Usage Examples Of Horde_Image_Base::loadFile