ImageJPEG

(PHP 3>= 3.0.16, PHP 4 >= 4.0.0)

ImageJPEG -- Output image to browser or file

Description

int imagejpeg (int im [, string filename [, int quality]])

ImageJPEG() creates the JPEG file in filename from the image im. The im argument is the return from the ImageCreate() function.

The filename argument is optional, and if left off, the raw image stream will be output directly. To skip the filename argument in order to provide a quality argument just use an empty string (''). By sending an image/jpeg content-type using header(), you can create a PHP script that outputs JPEG images directly.

Note: JPEG support is only available in PHP if PHP was compiled against GD-1.8 or later.

quality is optional, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). Default is to 100.

If you want to output Progressive JPEGs, you need to set interlacing on with the ImageInterlace().

See also ImagePNG(), ImageGIF(), ImageWBMP(), ImageInterlace() and ImageTypes().