final public function save($path, $quality = 75, $type = null)
    {
        // If no optional type is provided, then use current one
        if ($type === null) {
            $type = $this->type;
        }

        switch ($type) {
            case \IMAGETYPE_GIF:
                $result = imagegif($this->image, $path);
            break;

            case \IMAGETYPE_JPEG:
                $result = imagejpeg($this->image, $path, $quality);
            break;

            case \IMAGETYPE_PNG:
                $result = imagepng($this->image, $path, 9);
            break;

            default:
                throw new LogicException(sprintf(
                    'Can not save image format (%s) to %s', $type, $path
                ));
        }

        $this->done();
        // Returns boolean value indicating success or failure
        return $result;
    }
final public function save($path, $quality = 75, $type = null)
    {
        // If no optional type is provided, then use current one
        if ($type === null) {
            $type = $this->type;
        }

        switch ($type) {
            case \IMAGETYPE_GIF:
                $result = imagegif($this->image, $path);
            break;

            case \IMAGETYPE_JPEG:
                $result = imagejpeg($this->image, $path, $quality);
            break;

            case \IMAGETYPE_PNG:
                $result = imagepng($this->image, $path, 9);
            break;

            default:
                throw new LogicException(sprintf(
                    'Can not save image format (%s) to %s', $type, $path
                ));
        }

        $this->done();
        // Returns boolean value indicating success or failure
        return $result;
    }
final public function save ( $ path , $ quality = 75 , $ type = null ) { // If no optional type is provided, then use current one if ( $ type === null ) { $ type = $ this -> type ; } switch ( $ type ) { case \ IMAGETYPE_GIF : $ result = imagegif ( $ this -> image , $ path ) ; break ; case \ IMAGETYPE_JPEG : $ result = imagejpeg ( $ this -> image , $ path , $ quality ) ; break ; case \ IMAGETYPE_PNG : $ result = imagepng ( $ this -> image , $ path , 9 ) ; break ; default : throw new LogicException ( sprintf ( 'Can not save image format (%s) to %s' , $ type , $ path ) ) ; } $ this -> done ( ) ; // Returns boolean value indicating success or failure return $ result ; }
Saves an image to a file

@param string $path Full absolute path on the file system to save the image
@param integer $quality Image quality Medium quality by default
@param string $format Can be optionally saved in another format
@throws \LogicException if can't save to the target format
@return boolean
Saves an image to a file