From 288af5af9c504397916d7f680551672a5b91100f Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 31 Oct 2018 20:20:10 -0400 Subject: Add gif image support Adds 'image/gif' as an allowed mimetype for images. The image module is also updated to expect this new type. For background images, animated gifs will work properly. For head images, the cropping process truncates the image to only one frame; this is probably for the best. Signed-off-by: Malf Furious --- app/class/image.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/class/image.php') diff --git a/app/class/image.php b/app/class/image.php index 6b73cae..f4c639f 100644 --- a/app/class/image.php +++ b/app/class/image.php @@ -23,10 +23,12 @@ $_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; +$_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; $_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/png'] = "imagepng"; +$_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; /* * Open the given image and crop it, such that the result is a square -- cgit v1.2.3 From 175020d9acd5742d3a3cea4aa8e427ecc046b14b Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 31 Oct 2018 20:29:11 -0400 Subject: Add bmp image support Adds 'image/bmp' as an allowed mimetype for images. The image module is also updated to expect this new type. Signed-off-by: Malf Furious --- app/class/image.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/class/image.php') diff --git a/app/class/image.php b/app/class/image.php index f4c639f..591e026 100644 --- a/app/class/image.php +++ b/app/class/image.php @@ -24,11 +24,13 @@ $_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; $_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; $_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; +$_IMG_OPEN_FUNCS['image/bmp'] = "imagecreatefrombmp"; $_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; $_IMG_WRITE_FUNCS['image/png'] = "imagepng"; $_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; +$_IMG_WRITE_FUNCS['image/bmp'] = "imagebmp"; /* * Open the given image and crop it, such that the result is a square -- cgit v1.2.3 From 2cf8d6be4191512567dc7498d3163627aacd1cf0 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Wed, 31 Oct 2018 21:23:27 -0400 Subject: Fix bug in image support Adds 'image/x-ms-bmp' as an allowed mimetype for images, and is equivalent to 'image/bmp'. The image module is also updated to expect this new type. I found an image of mine that, when uploaded, PHP thought was 'image/bmp', so it was allowed. However, when cropping, PHP though it was 'image/x-ms-bmp' and failed to lookup a loading/writing function. Signed-off-by: Malf Furious --- app/class/image.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'app/class/image.php') diff --git a/app/class/image.php b/app/class/image.php index 591e026..62999aa 100644 --- a/app/class/image.php +++ b/app/class/image.php @@ -20,17 +20,19 @@ /* * Mappings from image MIME types to PHP open/write functions */ -$_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; -$_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; -$_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; -$_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; -$_IMG_OPEN_FUNCS['image/bmp'] = "imagecreatefrombmp"; +$_IMG_OPEN_FUNCS['image/jpeg'] = "imagecreatefromjpeg"; +$_IMG_OPEN_FUNCS['image/jpg'] = "imagecreatefromjpeg"; +$_IMG_OPEN_FUNCS['image/png'] = "imagecreatefrompng"; +$_IMG_OPEN_FUNCS['image/gif'] = "imagecreatefromgif"; +$_IMG_OPEN_FUNCS['image/bmp'] = "imagecreatefrombmp"; +$_IMG_OPEN_FUNCS['image/x-ms-bmp'] = "imagecreatefrombmp"; -$_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; -$_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; -$_IMG_WRITE_FUNCS['image/png'] = "imagepng"; -$_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; -$_IMG_WRITE_FUNCS['image/bmp'] = "imagebmp"; +$_IMG_WRITE_FUNCS['image/jpeg'] = "imagejpeg"; +$_IMG_WRITE_FUNCS['image/jpg'] = "imagejpeg"; +$_IMG_WRITE_FUNCS['image/png'] = "imagepng"; +$_IMG_WRITE_FUNCS['image/gif'] = "imagegif"; +$_IMG_WRITE_FUNCS['image/bmp'] = "imagebmp"; +$_IMG_WRITE_FUNCS['image/x-ms-bmp'] = "imagebmp"; /* * Open the given image and crop it, such that the result is a square -- cgit v1.2.3