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