public static function save($image, $path, $format)
    {
        switch ($format) {
            case IMAGETYPE_JPEG:
                $result = imagejpeg($image, $path, 100);
                break;
            case IMAGETYPE_PNG:
                $result = imagepng($image, $path, 9);
                break;
            case IMAGETYPE_GIF:
                $result = imagegif($image, $path);
                break;
        }

        if (!$result) {
            throw new \Exception("Failed to save image (" . $path . ")");
        }
    }
public static function save($image, $path, $format)
    {
        switch ($format) {
            case IMAGETYPE_JPEG:
                $result = imagejpeg($image, $path, 100);
                break;
            case IMAGETYPE_PNG:
                $result = imagepng($image, $path, 9);
                break;
            case IMAGETYPE_GIF:
                $result = imagegif($image, $path);
                break;
        }

        if (!$result) {
            throw new \Exception("Failed to save image (" . $path . ")");
        }
    }
public static function save ( $ image , $ path , $ format ) { switch ( $ format ) { case IMAGETYPE_JPEG : $ result = imagejpeg ( $ image , $ path , 100 ) ; break ; case IMAGETYPE_PNG : $ result = imagepng ( $ image , $ path , 9 ) ; break ; case IMAGETYPE_GIF : $ result = imagegif ( $ image , $ path ) ; break ; } if ( ! $ result ) { throw new \ Exception ( "Failed to save image (" . $ path . ")" ) ; } }
Save an image resource to the disk.

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

@return void
Save an image resource to the disk .