src/libraries/adapters/ImageGD.php
/**
    * Loads an image from a file path
    *
    * @param string $filename Full path to the file which will be manipulated
    * @return ImageGD
    */
Loads an image from a file path
@param string $filename Full path to the file which will be manipulated
@return ImageGD
Loads an image from a file path @param string $filename Full path to the file which will be manipulated @return ImageGD
public function load($filename)
  {
    $this->type = get_mime_type($filename);
    if(preg_match('/png$/', $this->type))
      $this->image = imagecreatefrompng($filename);
    elseif(preg_match('/gif$/', $this->type))
      $this->image = @imagecreatefromgif($filename);
    else
      $this->image = @imagecreatefromjpeg($filename);
    if(!$this->image)
      OPException::raise(new OPInvalidImageException('Could not create image with GD library'));
    $this->filename = $filename;
		$this->width = imagesx($this->image);
		$this->height = imagesy($this->image);
    return $this;
  }
public function load ( $ filename ) { $ this -> type = get_mime_type ( $ filename ) ; if ( preg_match ( '/png$/' , $ this -> type ) ) $ this -> image = imagecreatefrompng ( $ filename ) ; elseif ( preg_match ( '/gif$/' , $ this -> type ) ) $ this -> image = @ imagecreatefromgif ( $ filename ) ; else $ this -> image = @ imagecreatefromjpeg ( $ filename ) ; if ( ! $ this -> image ) OPException :: raise ( new OPInvalidImageException ( 'Could not create image with GD library' ) ) ; $ this -> filename = $ filename ; $ this -> width = imagesx ( $ this -> image ) ; $ this -> height = imagesy ( $ this -> image ) ; return $ this ; }
Loads an image from a file path
 @param string $filename Full path to the file which will be manipulated
 @return ImageGD
Loads an image from a file path @param string $filename Full path to the file which will be manipulated @return ImageGD