Skip to content

Commit

Permalink
Merge pull request #200 from Maef/avif-fix
Browse files Browse the repository at this point in the history
IMAGETYPE_AVIF not included in ImageTypeToMIMEtype()
  • Loading branch information
JamesHeinrich authored Nov 27, 2022
2 parents f580578 + f08e792 commit 36d47f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion phpthumb.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static function exif_info() {


public static function ImageTypeToMIMEtype($imagetype) {
if (function_exists('image_type_to_mime_type') && ($imagetype >= 1) && ($imagetype <= 18)) {
if (function_exists('image_type_to_mime_type') && ($imagetype >= 1) && ($imagetype <= 19)) {
// PHP v4.3.0+
return image_type_to_mime_type($imagetype);
}
Expand All @@ -196,6 +196,7 @@ public static function ImageTypeToMIMEtype($imagetype) {
16 => 'image/xbm', // IMAGETYPE_XBM
17 => 'image/x-icon', // IMAGETYPE_ICO
18 => 'image/webp', // IMAGETYPE_WEBP
19 => 'image/avif', // IMAGETYPE_AVIF

'gif' => 'image/gif', // IMAGETYPE_GIF
'jpg' => 'image/jpeg', // IMAGETYPE_JPEG
Expand All @@ -204,6 +205,7 @@ public static function ImageTypeToMIMEtype($imagetype) {
'bmp' => 'image/bmp', // IMAGETYPE_BMP
'ico' => 'image/x-icon', // IMAGETYPE_ICO
'webp' => 'image/webp', // IMAGETYPE_WEBP
'avif' => 'image/avif', // IMAGETYPE_AVIF
);

return (isset($image_type_to_mime_type[$imagetype]) ? $image_type_to_mime_type[$imagetype] : false);
Expand Down

0 comments on commit 36d47f2

Please sign in to comment.