imagewebp
imagewebp
Output a WebP image to browser or file
bool **imagewebp** GdImage $image $file int $quality
Outputs or saves a WebP version of the given .
image
filegd.image.path
quality
ranges from 0 (worst
quality, smaller file) to 100 (best quality, biggest file).
If is provided, the default value is used.
quality``-1``80
return.success
Throws a if is invalid.
ValueError``quality
Voorbeeld: Saving an WebP file
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'WebP with PHP', $text_color);
// Save the image
imagewebp($im, 'php.webp');
?>