GdThumb::show PHP 메소드

show() 공개 메소드

This function will show the current image by first sending the appropriate header for the format, and then outputting the image data. If headers have already been sent, a runtime exception will be thrown
public show ( boolean $rawData = false ) : GdThumb
$rawData boolean Whether or not the raw image stream should be output
리턴 GdThumb
    public function show($rawData = false)
    {
        if (headers_sent()) {
            throw new RuntimeException('Cannot show image, headers have already been sent');
        }
        switch ($this->format) {
            case 'GIF':
                if ($rawData === false) {
                    header('Content-type: image/gif');
                }
                imagegif($this->oldImage);
                break;
            case 'JPG':
                if ($rawData === false) {
                    header('Content-type: image/jpeg');
                }
                imagejpeg($this->oldImage, null, $this->options['jpegQuality']);
                break;
            case 'PNG':
            case 'STRING':
                if ($rawData === false) {
                    header('Content-type: image/png');
                }
                imagepng($this->oldImage);
                break;
        }
        return $this;
    }