Skip to content

Commit

Permalink
Added support for bmp, avif and webp images in thumbnails.
Browse files Browse the repository at this point in the history
  • Loading branch information
parpalak committed Sep 24, 2024
1 parent 5bfa46e commit 5e4924f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions _include/src/Image/ThumbnailGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ public static function createImageFromFile(string $inputFilename): \GdImage
return imagecreatefromwbmp($inputFilename);
}
throw new \RuntimeException('WBMP images are not supported');

case 'image/webp':
if (imagetypes() & IMG_WEBP) {
return imagecreatefromwebp($inputFilename);
}
throw new \RuntimeException('WebP images are not supported');

case 'image/avif':
if (imagetypes() & IMG_AVIF) {
return imagecreatefromavif($inputFilename);
}
throw new \RuntimeException('AVIF images are not supported');

case 'image/bmp':
if (imagetypes() & IMG_BMP) {
return imagecreatefrombmp($inputFilename);
}
throw new \RuntimeException('BMP images are not supported');
}

throw new \RuntimeException($imageInfo['mime'] . ' images are not supported');
Expand Down

0 comments on commit 5e4924f

Please sign in to comment.