protected function get_meta_data() {
        //gather meta data
        if (empty($this->imagestring)) {
            $info = getimagesize($this->filename);
            switch ($info['mime']) {
                case 'image/gif':
                    $this->image = imagecreatefromgif($this->filename);
                    break;
                case 'image/jpeg':
                    $this->image = imagecreatefromjpeg($this->filename);
                    break;
                case 'image/png':
                    $this->image = imagecreatefrompng($this->filename);
                    break;
                default:
                    throw new Exception('Invalid image: ' . $this->filename);
                    break;
            }
        } elseif (function_exists('getimagesizefromstring')) {
            $info = getimagesizefromstring($this->imagestring);
        } else {
            throw new Exception('PHP 5.4 is required to use method getimagesizefromstring');
        }
        $this->original_info = array(
            'width' => $info[0],
            'height' => $info[1],
            'orientation' => $this->get_orientation(),
            'exif' => function_exists('exif_read_data') && $info['mime'] === 'image/jpeg' && $this->imagestring === null ? $this->exif = @exif_read_data($this->filename) : null,
            'format' => preg_replace('/^image\//', '', $info['mime']),
            'mime' => $info['mime']
        );
        $this->width = $info[0];
        $this->height = $info[1];
        imagesavealpha($this->image, true);
        imagealphablending($this->image, true);
        return $this;
    }
protected function get_meta_data() {
        //gather meta data
        if (empty($this->imagestring)) {
            $info = getimagesize($this->filename);
            switch ($info['mime']) {
                case 'image/gif':
                    $this->image = imagecreatefromgif($this->filename);
                    break;
                case 'image/jpeg':
                    $this->image = imagecreatefromjpeg($this->filename);
                    break;
                case 'image/png':
                    $this->image = imagecreatefrompng($this->filename);
                    break;
                default:
                    throw new Exception('Invalid image: ' . $this->filename);
                    break;
            }
        } elseif (function_exists('getimagesizefromstring')) {
            $info = getimagesizefromstring($this->imagestring);
        } else {
            throw new Exception('PHP 5.4 is required to use method getimagesizefromstring');
        }
        $this->original_info = array(
            'width' => $info[0],
            'height' => $info[1],
            'orientation' => $this->get_orientation(),
            'exif' => function_exists('exif_read_data') && $info['mime'] === 'image/jpeg' && $this->imagestring === null ? $this->exif = @exif_read_data($this->filename) : null,
            'format' => preg_replace('/^image\//', '', $info['mime']),
            'mime' => $info['mime']
        );
        $this->width = $info[0];
        $this->height = $info[1];
        imagesavealpha($this->image, true);
        imagealphablending($this->image, true);
        return $this;
    }
protected function get_meta_data ( ) { //gather meta data if ( empty ( $ this -> imagestring ) ) { $ info = getimagesize ( $ this -> filename ) ; switch ( $ info [ 'mime' ] ) { case 'image/gif' : $ this -> image = imagecreatefromgif ( $ this -> filename ) ; break ; case 'image/jpeg' : $ this -> image = imagecreatefromjpeg ( $ this -> filename ) ; break ; case 'image/png' : $ this -> image = imagecreatefrompng ( $ this -> filename ) ; break ; default : throw new Exception ( 'Invalid image: ' . $ this -> filename ) ; break ; } } elseif ( function_exists ( 'getimagesizefromstring' ) ) { $ info = getimagesizefromstring ( $ this -> imagestring ) ; } else { throw new Exception ( 'PHP 5.4 is required to use method getimagesizefromstring' ) ; } $ this -> original_info = array ( 'width' => $ info [ 0 ] , 'height' => $ info [ 1 ] , 'orientation' => $ this -> get_orientation ( ) , 'exif' => function_exists ( 'exif_read_data' ) && $ info [ 'mime' ] === 'image/jpeg' && $ this -> imagestring === null ? $ this -> exif = @ exif_read_data ( $ this -> filename ) : null , 'format' => preg_replace ( '/^image\//' , '' , $ info [ 'mime' ] ) , 'mime' => $ info [ 'mime' ] ) ; $ this -> width = $ info [ 0 ] ; $ this -> height = $ info [ 1 ] ; imagesavealpha ( $ this -> image , true ) ; imagealphablending ( $ this -> image , true ) ; return $ this ; }
Get meta data of image or base64 string

@param string|null       $imagestring    If omitted treat as a normal image

@return SimpleImage
@throws Exception
Get meta data of image or base64 string