Image_GD::__construct PHP Method

__construct() public method

Runs [Image_GD::check] and loads the image.
public __construct ( string $file, boolean $useProgressiveJpeg = false ) : void
$file string image file path
$useProgressiveJpeg boolean use progressive JPEG format
return void
    public function __construct($file, $useProgressiveJpeg = false)
    {
        if (!Image_GD::$_checked) {
            // Run the install check
            Image_GD::check();
        }
        parent::__construct($file);
        // Set the image creation function name
        switch ($this->type) {
            case IMAGETYPE_JPEG:
                $create = 'imagecreatefromjpeg';
                $this->_isProgressiveJpeg = $useProgressiveJpeg;
                break;
            case IMAGETYPE_GIF:
                $create = 'imagecreatefromgif';
                break;
            case IMAGETYPE_PNG:
                $create = 'imagecreatefrompng';
                break;
        }
        if (!isset($create) or !function_exists($create)) {
            throw new CException('Installed GD does not support ' . image_type_to_extension($this->type, FALSE) . ' images');
        }
        // Save function for future use
        $this->_create_function = $create;
        // Save filename for lazy loading
        $this->_image = $this->file;
    }