JBZoo\Image\Image::_renderImageByFormat PHP Method

_renderImageByFormat() protected method

Render image resource as binary
protected _renderImageByFormat ( string $format, string $filename, integer $quality ) : boolean | string
$format string
$filename string
$quality integer
return boolean | string
    protected function _renderImageByFormat($format, $filename, $quality)
    {
        if (!$this->_image) {
            throw new Exception('Image resource not defined');
        }
        $format = $format ?: $this->_mime;
        $result = false;
        if (Helper::isJpeg($format)) {
            if ($this->_saveJpeg($filename, $quality)) {
                $result = 'image/jpeg';
            }
        } elseif (Helper::isPng($format)) {
            if ($this->_savePng($filename, $quality)) {
                $result = 'image/png';
            }
        } elseif (Helper::isGif($format)) {
            if ($this->_saveGif($filename)) {
                $result = 'image/gif';
            }
        } else {
            throw new Exception('Undefined format: ' . $format);
        }
        return $result;
    }