bored

A micro PHP framework
git clone git://git.bitsmanent.org/bored
Log | Files | Refs | README

commit 23aa884628850ef72f1af38b672872079fb5cf8f
parent c3f7c6d98994c68fffd791a712b8859a08d9fa9b
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Wed,  6 Nov 2019 11:27:41 +0100

Better file type detection for images (don't rely on extension).

Diffstat:
Mbored.php | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bored.php b/bored.php @@ -254,7 +254,11 @@ function imgresize($src, $saveas, $whxy = '64x64-0,0', $opts = NULL) { $in = NULL; $out = NULL; $transparency = false; - $ext = strtolower((string)@pathinfo($src)['extension']); + + $t = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $src); + $ext = explode('/', $t)[1]; + //$ext = strtolower((string)@pathinfo($src)['extension']); + switch($ext) { case 'jpg': case 'jpeg':