X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;f=wcfsetup%2Finstall%2Ffiles%2Flib%2Fsystem%2Fimage%2Fadapter%2FGDImageAdapter.class.php;h=9d61e08f67ac7047db35861509ea6eb8331742f5;hb=58b2ac9392d2677c4becd317c89844d3e7ef28e6;hp=d98d05249111c998b7664e38ca70b7cf63d3076e;hpb=b5b644ad5f6f829e9ccb2188a7de6d17f8816a56;p=GitHub%2FWoltLab%2FWCF.git diff --git a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php index d98d052491..9d61e08f67 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php @@ -111,9 +111,16 @@ class GDImageAdapter implements IImageAdapter { } break; + case IMAGETYPE_WEBP: + // suppress warnings and properly handle errors + $this->image = @imagecreatefromwebp($file); + if ($this->image === false) { + throw new SystemException("Could not read webp image '".$file."'."); + } + break; + default: throw new SystemException("Could not read image '".$file."', format is not recognized."); - break; } } @@ -348,6 +355,9 @@ class GDImageAdapter implements IImageAdapter { else if ($this->type == IMAGETYPE_PNG) { imagepng($image); } + else if ($this->type == IMAGETYPE_WEBP) { + imagewebp($image); + } else if (function_exists('imageJPEG')) { imagejpeg($image, null, 90); } @@ -429,7 +439,7 @@ class GDImageAdapter implements IImageAdapter { * @param integer $pct opacity percent * @return boolean */ - private function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct) { + private function imagecopymerge_alpha($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $pct) { // phpcs:ignore if (!isset($pct)) { return false; }