Summary: Output a PNG image to either the browser or a file
bool imagepng(resource $image[, mixed $to, int $quality, int $filters])
Outputs or saves a PNG image from the given
TRUE on success or
FALSE on failure.
- resource $image: An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().
- mixed $to: The path or an open stream resource (which is automatically being closed after this function returns) to save the file to. If not set or
NULL, the raw image stream will be outputted directly.
NULLis invalid if the
filtersarguments are not used.
- int $quality: Compression level: from 0 (no compression) to 9.
- int $filters: Allows reducing the PNG file size. It is a bitmask field which may be set to any combination of the PNG_FILTER_XXX constants.
PNG_ALL_FILTERSmay also be used to respectively disable or activate all filters.
- NULL is invalid if the quality and filters arguments are not used.
|5.4.0||Added support for passing a stream resource to |
|5.1.3||Added the |
|5.1.2||Added the |