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