GD and Image 함수 목록
PHP Manual

imagewebp

(PHP 5 >= 5.5.0, PHP 7)

imagewebpOutput a WebP image to browser or file

설명

bool imagewebp ( resource $image , mixed $to [, int $quality = 80 ] )

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를 반환합니다.

변경점

버전 설명
5.4.0 Added support for passing a stream resource to to.

예제

Example #1 Saving an WebP file

<?php
// Create a blank image and add some text
$im imagecreatetruecolor(12020);
$text_color imagecolorallocate($im2331491);

imagestring($im155,  'WebP with PHP'$text_color);

// Save the image
imagewebp($im'php.webp');

// Free up memory
imagedestroy($im);
?>


GD and Image 함수 목록
PHP Manual