Skip to content

Commit 3243cfd

Browse files
denno020jdecool
authored andcommitted
Added webp support (#100)
Added webp support
1 parent 6ea47ce commit 3243cfd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/PHPImageWorkshop/Core/ImageWorkshopLayer.php

+7
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,13 @@ public function save($folder, $imageName, $createFolders = true, $backgroundColo
15691569

15701570
$isSaved = imagepng($image, $filename, intval($imageQuality));
15711571

1572+
} elseif ($extension == 'webp') {
1573+
if (!function_exists('imagewebp')) {
1574+
throw new ImageWorkshopLayerException(sprintf('Image format "%s" not supported by PHP version', $extension), self::ERROR_NOT_SUPPORTED_FORMAT);
1575+
}
1576+
1577+
$isSaved = imagewebp($image, $filename, $imageQuality);
1578+
15721579
} else {
15731580

15741581
throw new ImageWorkshopLayerException(sprintf('Image format "%s" not supported.', $extension), self::ERROR_NOT_SUPPORTED_FORMAT);

0 commit comments

Comments
 (0)