public static function get($path, array $info = null)
    {
        $info = $info ?: self::getSize($path);

        switch ($info['mime']) {
            case self::TYPE_JPG:
                $srcImg = imagecreatefromjpeg($path);
                break;
            case self::TYPE_PNG:
                $srcImg = imagecreatefrompng($path);
                break;
            case self::TYPE_GIF:
                $srcImg = imagecreatefromgif($path);
                break;
            case self::TYPE_BMP:
                $srcImg = imagecreatefromwbmp($path);
                break;
            case self::TYPE_WEBP:
                $srcImg = imagecreatefromwebp($path);
                break;
            default:
                throw new FileInvalidTypeException('Not supported image type.');
        }

        return $srcImg;
    }
public static function get($path, array $info = null)
    {
        $info = $info ?: self::getSize($path);

        switch ($info['mime']) {
            case self::TYPE_JPG:
                $srcImg = imagecreatefromjpeg($path);
                break;
            case self::TYPE_PNG:
                $srcImg = imagecreatefrompng($path);
                break;
            case self::TYPE_GIF:
                $srcImg = imagecreatefromgif($path);
                break;
            case self::TYPE_BMP:
                $srcImg = imagecreatefromwbmp($path);
                break;
            case self::TYPE_WEBP:
                $srcImg = imagecreatefromwebp($path);
                break;
            default:
                throw new FileInvalidTypeException('Not supported image type.');
        }

        return $srcImg;
    }
public static function get ( $ path , array $ info = null ) { $ info = $ info ? : self :: getSize ( $ path ) ; switch ( $ info [ 'mime' ] ) { case self :: TYPE_JPG : $ srcImg = imagecreatefromjpeg ( $ path ) ; break ; case self :: TYPE_PNG : $ srcImg = imagecreatefrompng ( $ path ) ; break ; case self :: TYPE_GIF : $ srcImg = imagecreatefromgif ( $ path ) ; break ; case self :: TYPE_BMP : $ srcImg = imagecreatefromwbmp ( $ path ) ; break ; case self :: TYPE_WEBP : $ srcImg = imagecreatefromwebp ( $ path ) ; break ; default : throw new FileInvalidTypeException ( 'Not supported image type.' ) ; } return $ srcImg ; }
Make and return an image resource from file
@param string $path
@param array $info
@return resource
@throws FileInvalidTypeException
Make and return an image resource from file