Forum und email

imagejpeg

(PHP 4, PHP 5)

imagejpeg — Output image to browser or file

說明

bool imagejpeg ( resource $image [, string $filename [, int $quality ]] )

imagejpeg() creates a JPEG file from the given image .

參數

image

An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().

filename

The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.

To skip this argument in order to provide the quality parameter, use NULL.

quality

quality is optional, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default is the default IJG quality value (about 75).

Return值

如果成功則回傳 TRUE,失敗則回傳 FALSE

註釋

Note: JPEG 支持僅在 PHP 與 GD-1.8 或更高版本一起編譯時可用。

Note: If you want to output Progressive JPEGs, you need to set interlacing on with imageinterlace().