Home > PHP > Function > GD > imagejpeg()

imagejpeg()

imagejpeg - Output image to browser or file

Syntax

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

Arguments

  • 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).

Description

imagejpeg() creates a JPEGfile from the given image.

Version

PHP 4, 5

Return value

Returns TRUE on success or FALSE on failure.