From d6f3de09e8f6e4858239fc6d23c6fb75bc4cd5b1 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 22 Oct 2013 16:08:29 +0200 Subject: [PATCH 1/2] Bugfix: The function "exif_imagetype" doesn't seem to be available at every system. So we emulate it. --- boot.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/boot.php b/boot.php index 57414e8f..a4e2cfe4 100644 --- a/boot.php +++ b/boot.php @@ -2175,3 +2175,27 @@ function set_template_engine(&$a, $engine = 'internal') { $a->set_template_engine($engine); } +if(!function_exists('exif_imagetype')) { + function exif_imagetype($file) { + $size = getimagesize($file); + + switch ($size["mime"]) { + case "image/jpeg": + $imagetype = IMAGETYPE_JPEG; + break; + case "image/gif": + $imagetype = IMAGETYPE_GIF; + break; + case "image/png": + $imagetype = IMAGETYPE_PNG; + break; + case "": + $imagetype = ""; + break; + default: + $imagetype = 99; + } + + return($imagetype); + } +} From 5b6e16d1939b5ef4b77cdc955665d449abcd2b2f Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 22 Oct 2013 16:19:55 +0200 Subject: [PATCH 2/2] The emulation for the exif function is now much more sleaker --- boot.php | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/boot.php b/boot.php index a4e2cfe4..af164ec4 100644 --- a/boot.php +++ b/boot.php @@ -2176,26 +2176,8 @@ function set_template_engine(&$a, $engine = 'internal') { } if(!function_exists('exif_imagetype')) { - function exif_imagetype($file) { - $size = getimagesize($file); - - switch ($size["mime"]) { - case "image/jpeg": - $imagetype = IMAGETYPE_JPEG; - break; - case "image/gif": - $imagetype = IMAGETYPE_GIF; - break; - case "image/png": - $imagetype = IMAGETYPE_PNG; - break; - case "": - $imagetype = ""; - break; - default: - $imagetype = 99; - } - - return($imagetype); - } + function exif_imagetype($file) { + $size = getimagesize($file); + return($size[2]); + } }