private function loadImageFromFile($filepath)
    {
        $this->from = 'local';
        $this->filename = $filepath;

        if (!is_readable($filepath)) {
            return;
        }

        $image = null;
        $extension = '';
        list($width, $height, $imageType) = getimagesize($filepath);

        switch ($imageType) {
            case IMAGETYPE_GIF:
                $extension = 'gif';
                $image = imagecreatefromgif($filepath);
                break;

            case IMAGETYPE_PNG:
                $extension = 'png';
                $image = imagecreatefrompng($filepath);
                break;

            case IMAGETYPE_JPEG:
                $extension = 'jpg';
                $image = imagecreatefromjpeg($filepath);
                break;
        }

        if ($image) {
            $this->type = $imageType;
            $this->resource = $image;
            $this->extension = $extension;
            $this->width = $this->boxWidth = $width;
            $this->height = $this->boxHeight = $height;
        }
    }
private function loadImageFromFile($filepath)
    {
        $this->from = 'local';
        $this->filename = $filepath;

        if (!is_readable($filepath)) {
            return;
        }

        $image = null;
        $extension = '';
        list($width, $height, $imageType) = getimagesize($filepath);

        switch ($imageType) {
            case IMAGETYPE_GIF:
                $extension = 'gif';
                $image = imagecreatefromgif($filepath);
                break;

            case IMAGETYPE_PNG:
                $extension = 'png';
                $image = imagecreatefrompng($filepath);
                break;

            case IMAGETYPE_JPEG:
                $extension = 'jpg';
                $image = imagecreatefromjpeg($filepath);
                break;
        }

        if ($image) {
            $this->type = $imageType;
            $this->resource = $image;
            $this->extension = $extension;
            $this->width = $this->boxWidth = $width;
            $this->height = $this->boxHeight = $height;
        }
    }
private function loadImageFromFile ( $ filepath ) { $ this -> from = 'local' ; $ this -> filename = $ filepath ; if ( ! is_readable ( $ filepath ) ) { return ; } $ image = null ; $ extension = '' ; list ( $ width , $ height , $ imageType ) = getimagesize ( $ filepath ) ; switch ( $ imageType ) { case IMAGETYPE_GIF : $ extension = 'gif' ; $ image = imagecreatefromgif ( $ filepath ) ; break ; case IMAGETYPE_PNG : $ extension = 'png' ; $ image = imagecreatefrompng ( $ filepath ) ; break ; case IMAGETYPE_JPEG : $ extension = 'jpg' ; $ image = imagecreatefromjpeg ( $ filepath ) ; break ; } if ( $ image ) { $ this -> type = $ imageType ; $ this -> resource = $ image ; $ this -> extension = $ extension ; $ this -> width = $ this -> boxWidth = $ width ; $ this -> height = $ this -> boxHeight = $ height ; } }
Load an image file from path.

@param  string $filepath File path
@return void
Load an image file from path .