File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -306,8 +306,38 @@ protected function supportedFormatCheck()
306306 return ;
307307 }
308308
309- if ($ this ->image ()->imageType === IMAGETYPE_WEBP && ! in_array ('WEBP ' , Imagick::queryFormats (), true )) {
310- throw ImageException::forInvalidImageCreate (lang ('Images.webpNotSupported ' ));
309+ $ supported = Imagick::queryFormats ();
310+
311+ switch ($ this ->image ()->imageType ) {
312+ case IMAGETYPE_GIF :
313+ if (! in_array ('GIF ' , $ supported , true )) {
314+ throw ImageException::forInvalidImageCreate (lang ('Images.gifNotSupported ' ));
315+ }
316+ break ;
317+
318+ case IMAGETYPE_JPEG :
319+ if (! in_array ('JPEG ' , $ supported , true )) {
320+ throw ImageException::forInvalidImageCreate (lang ('Images.jpgNotSupported ' ));
321+ }
322+ break ;
323+
324+ case IMAGETYPE_PNG :
325+ if (! in_array ('PNG ' , $ supported , true )) {
326+ throw ImageException::forInvalidImageCreate (lang ('Images.pngNotSupported ' ));
327+ }
328+ break ;
329+
330+ case IMAGETYPE_WEBP :
331+ if (! in_array ('WEBP ' , $ supported , true )) {
332+ throw ImageException::forInvalidImageCreate (lang ('Images.webpNotSupported ' ));
333+ }
334+ break ;
335+
336+ case IMAGETYPE_AVIF :
337+ if (! in_array ('AVIF ' , $ supported , true )) {
338+ throw ImageException::forInvalidImageCreate (lang ('Images.avifNotSupported ' ));
339+ }
340+ break ;
311341 }
312342 }
313343
You can’t perform that action at this time.
0 commit comments