public static function create($path, $format)
    {
        switch ($format) {
            case IMAGETYPE_JPEG:
                $result = imagecreatefromjpeg($path);
                break;
            case IMAGETYPE_PNG:
                $result = imagecreatefrompng($path);
                break;
            case IMAGETYPE_GIF:
                $result = imagecreatefromgif($path);
                break;
        }

        if (!$result) {
            throw new \Exception("Failing to create image (" . $path . ")");
        }

        return $result;
    }
public static function create($path, $format)
    {
        switch ($format) {
            case IMAGETYPE_JPEG:
                $result = imagecreatefromjpeg($path);
                break;
            case IMAGETYPE_PNG:
                $result = imagecreatefrompng($path);
                break;
            case IMAGETYPE_GIF:
                $result = imagecreatefromgif($path);
                break;
        }

        if (!$result) {
            throw new \Exception("Failing to create image (" . $path . ")");
        }

        return $result;
    }
public static function create ( $ path , $ format ) { switch ( $ format ) { case IMAGETYPE_JPEG : $ result = imagecreatefromjpeg ( $ path ) ; break ; case IMAGETYPE_PNG : $ result = imagecreatefrompng ( $ path ) ; break ; case IMAGETYPE_GIF : $ result = imagecreatefromgif ( $ path ) ; break ; } if ( ! $ result ) { throw new \ Exception ( "Failing to create image (" . $ path . ")" ) ; } return $ result ; }
Create an image resource from an image on disk.

@param string $path The path to load the image from
@param int $format Image type constant (http://php.net/manual/en/image.constants.php)

@return resource
Create an image resource from an image on disk .