Add .webp support
This commit is contained in:
parent
7995d862bc
commit
1868c63b93
2 changed files with 204 additions and 195 deletions
|
@ -932,7 +932,7 @@ function transformImage($file, $imageDir, $thumbnailDir = false)
|
||||||
|
|
||||||
// Generate Thumbnail
|
// Generate Thumbnail
|
||||||
if (!empty($thumbnailDir)) {
|
if (!empty($thumbnailDir)) {
|
||||||
if (($fileExtension == 'svg') || ($fileExtension == 'webp')) {
|
if (($fileExtension == 'svg')) {
|
||||||
Filesystem::symlink($image, $thumbnailDir . $nextFilename);
|
Filesystem::symlink($image, $thumbnailDir . $nextFilename);
|
||||||
} else {
|
} else {
|
||||||
$Image = new Image();
|
$Image = new Image();
|
||||||
|
|
|
@ -62,6 +62,12 @@ class Image {
|
||||||
imagepng($this->imageResized, $path_complete, $invertScaleQuality);
|
imagepng($this->imageResized, $path_complete, $invertScaleQuality);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'webp':
|
||||||
|
// Checking for JPG support
|
||||||
|
if (imagetypes() & IMG_WEBP) {
|
||||||
|
imagewebp($this->imageResized, $path_complete, $imageQuality);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Fail extension detection
|
// Fail extension detection
|
||||||
|
@ -88,6 +94,9 @@ class Image {
|
||||||
case '.png':
|
case '.png':
|
||||||
$img = imagecreatefrompng($file);
|
$img = imagecreatefrompng($file);
|
||||||
break;
|
break;
|
||||||
|
case '.webp':
|
||||||
|
$img = imagecreatefromwebp($file);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$img = false;
|
$img = false;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue