imagewebp

Supported Versions: PHP 5 >= 5.4.0, PHP 7, PHP 8
Output a WebP image to browser or file
<?php imagewebp(GdImage $image, resource|string|null $file = null, int $quality = -1): bool
<?php         imagepalettetotruecolor($this->image->getCore());

        imagealphablending($this->image->getCore(), true);

        imagesavealpha($this->image->getCore(), true);

        imagewebp($this->image->getCore(), null, $this->quality);

        $this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp';

        $buffer = ob_get_contents();

        ob_end_clean();