}
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;
}
}
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);
}
* @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;
}