function output($format = null, $quality = null) {
        // Determine quality
        $quality = $quality ? : $this->quality;
        // Determine mimetype
        switch (strtolower($format)) {
            case 'gif':
                $mimetype = 'image/gif';
                break;
            case 'jpeg':
            case 'jpg':
                imageinterlace($this->image, true);
                $mimetype = 'image/jpeg';
                break;
            case 'png':
                $mimetype = 'image/png';
                break;
            default:
                $info = (empty($this->imagestring)) ? getimagesize($this->filename) : getimagesizefromstring($this->imagestring);
                $mimetype = $info['mime'];
                unset($info);
                break;
        }
        // Output the image
        header('Content-Type: ' . $mimetype);
        switch ($mimetype) {
            case 'image/gif':
                imagegif($this->image);
                break;
            case 'image/jpeg':
                imageinterlace($this->image, true);
                imagejpeg($this->image, null, round($quality));
                break;
            case 'image/png':
                imagepng($this->image, null, round(9 * $quality / 100));
                break;
            default:
                throw new Exception('Unsupported image format: ' . $this->filename);
                break;
        }
    }
function output($format = null, $quality = null) {
        // Determine quality
        $quality = $quality ? : $this->quality;
        // Determine mimetype
        switch (strtolower($format)) {
            case 'gif':
                $mimetype = 'image/gif';
                break;
            case 'jpeg':
            case 'jpg':
                imageinterlace($this->image, true);
                $mimetype = 'image/jpeg';
                break;
            case 'png':
                $mimetype = 'image/png';
                break;
            default:
                $info = (empty($this->imagestring)) ? getimagesize($this->filename) : getimagesizefromstring($this->imagestring);
                $mimetype = $info['mime'];
                unset($info);
                break;
        }
        // Output the image
        header('Content-Type: ' . $mimetype);
        switch ($mimetype) {
            case 'image/gif':
                imagegif($this->image);
                break;
            case 'image/jpeg':
                imageinterlace($this->image, true);
                imagejpeg($this->image, null, round($quality));
                break;
            case 'image/png':
                imagepng($this->image, null, round(9 * $quality / 100));
                break;
            default:
                throw new Exception('Unsupported image format: ' . $this->filename);
                break;
        }
    }
function output ( $ format = null , $ quality = null ) { // Determine quality $ quality = $ quality ? : $ this -> quality ; // Determine mimetype switch ( strtolower ( $ format ) ) { case 'gif' : $ mimetype = 'image/gif' ; break ; case 'jpeg' : case 'jpg' : imageinterlace ( $ this -> image , true ) ; $ mimetype = 'image/jpeg' ; break ; case 'png' : $ mimetype = 'image/png' ; break ; default : $ info = ( empty ( $ this -> imagestring ) ) ? getimagesize ( $ this -> filename ) : getimagesizefromstring ( $ this -> imagestring ) ; $ mimetype = $ info [ 'mime' ] ; unset ( $ info ) ; break ; } // Output the image header ( 'Content-Type: ' . $ mimetype ) ; switch ( $ mimetype ) { case 'image/gif' : imagegif ( $ this -> image ) ; break ; case 'image/jpeg' : imageinterlace ( $ this -> image , true ) ; imagejpeg ( $ this -> image , null , round ( $ quality ) ) ; break ; case 'image/png' : imagepng ( $ this -> image , null , round ( 9 * $ quality / 100 ) ) ; break ; default : throw new Exception ( 'Unsupported image format: ' . $ this -> filename ) ; break ; } }
Outputs image without saving

@param null|string   $format     If omitted or null - format of original file will be used, may be gif|jpg|png
@param int|null      $quality    Output image quality in percents 0-100

@throws Exception
Outputs image without saving