public function save($saveName, $quality = 80)
    {
        $type         = $this->getType(pathinfo($saveName, PATHINFO_EXTENSION));
        $imageFunc    = 'image' . $type;
        $errorMessage = 'Image saved is failed! Check the directory is can write?';

        if ($type === 'jpeg')
        {
            imageinterlace($this->newImage, true);

            if ( !$imageFunc($this->newImage, $saveName, $quality) )
            {
                throw new \ErrorException($errorMessage);
            }
        }
        else
        {
            if (!$imageFunc($this->newImage, $saveName))
            {
                throw new \ErrorException($errorMessage);
            }
        }

        $this->destroyAll();

        return $this;
    }
public function save($saveName, $quality = 80)
    {
        $type         = $this->getType(pathinfo($saveName, PATHINFO_EXTENSION));
        $imageFunc    = 'image' . $type;
        $errorMessage = 'Image saved is failed! Check the directory is can write?';

        if ($type === 'jpeg')
        {
            imageinterlace($this->newImage, true);

            if ( !$imageFunc($this->newImage, $saveName, $quality) )
            {
                throw new \ErrorException($errorMessage);
            }
        }
        else
        {
            if (!$imageFunc($this->newImage, $saveName))
            {
                throw new \ErrorException($errorMessage);
            }
        }

        $this->destroyAll();

        return $this;
    }
public function save ( $ saveName , $ quality = 80 ) { $ type = $ this -> getType ( pathinfo ( $ saveName , PATHINFO_EXTENSION ) ) ; $ imageFunc = 'image' . $ type ; $ errorMessage = 'Image saved is failed! Check the directory is can write?' ; if ( $ type === 'jpeg' ) { imageinterlace ( $ this -> newImage , true ) ; if ( ! $ imageFunc ( $ this -> newImage , $ saveName , $ quality ) ) { throw new \ ErrorException ( $ errorMessage ) ; } } else { if ( ! $ imageFunc ( $ this -> newImage , $ saveName ) ) { throw new \ ErrorException ( $ errorMessage ) ; } } $ this -> destroyAll ( ) ; return $ this ; }
Saved image file

@param string $saveName
@param int $quality 80
@return $this
@throws \ErrorException
Saved image file