(PHP 5 >= 5.5.0, PHP 7)
imagewebp — Output a WebP image to browser or file
Outputs or save an WebP version of the given image
.
image
imagecreatetruecolor() 등의 이미지 생성 함수에서 반환한 이미지 자원.
to
저장할 파일 경로. 지정하지 않거나 NULL
일 경우에는, raw 이미지 스트림을 직접 출력합니다.
quality
quality
ranges from 0 (worst
quality, smaller file) to 100 (best quality, biggest file).
성공 시 TRUE
를, 실패 시 FALSE
를 반환합니다.
Example #1 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');
// Free up memory
imagedestroy($im);
?>