public function save($filename)
    {
        $type = pathinfo($filename, PATHINFO_EXTENSION);
        $type = ($type === 'jpg') ? 'jpeg' : $type;
        $type = (in_array($type, $this->imageTypes)) ? $type : 'png';

        header('Content-type: image/' . $type);

        $imageFunc = 'image' . $type;
        $imageFunc($this->image, $filename);

        $this->destroy($this->image);

        return $this;
    }
public function save($filename)
    {
        $type = pathinfo($filename, PATHINFO_EXTENSION);
        $type = ($type === 'jpg') ? 'jpeg' : $type;
        $type = (in_array($type, $this->imageTypes)) ? $type : 'png';

        header('Content-type: image/' . $type);

        $imageFunc = 'image' . $type;
        $imageFunc($this->image, $filename);

        $this->destroy($this->image);

        return $this;
    }
public function save ( $ filename ) { $ type = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; $ type = ( $ type === 'jpg' ) ? 'jpeg' : $ type ; $ type = ( in_array ( $ type , $ this -> imageTypes ) ) ? $ type : 'png' ; header ( 'Content-type: image/' . $ type ) ; $ imageFunc = 'image' . $ type ; $ imageFunc ( $ this -> image , $ filename ) ; $ this -> destroy ( $ this -> image ) ; return $ this ; }
Save captcha image file

@param string $filename
@return $this
Save captcha image file