mirror of
https://github.com/Intervention/image.git
synced 2025-08-21 13:11:18 +02:00
Check for existance of IMG_WEBP_LOSSLESS constant
Constant is only presnet, if the used libgd supports lossless WebP encoding.
This commit is contained in:
@@ -18,7 +18,7 @@ class WebpEncoder extends GenericWebpEncoder implements SpecializedInterface
|
|||||||
*/
|
*/
|
||||||
public function encode(ImageInterface $image): EncodedImage
|
public function encode(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$quality = $this->quality === 100 ? IMG_WEBP_LOSSLESS : $this->quality;
|
$quality = $this->quality === 100 && defined('IMG_WEBP_LOSSLESS') ? IMG_WEBP_LOSSLESS : $this->quality;
|
||||||
|
|
||||||
return $this->createEncodedImage(function ($pointer) use ($image, $quality): void {
|
return $this->createEncodedImage(function ($pointer) use ($image, $quality): void {
|
||||||
imagewebp($image->core()->native(), $pointer, $quality);
|
imagewebp($image->core()->native(), $pointer, $quality);
|
||||||
|
Reference in New Issue
Block a user