From: Michael Vogel Date: Tue, 22 Oct 2013 14:08:29 +0000 (+0200) Subject: Bugfix: The function "exif_imagetype" doesn't seem to be available at every system... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d6f3de09e8f6e4858239fc6d23c6fb75bc4cd5b1;p=friendica.git Bugfix: The function "exif_imagetype" doesn't seem to be available at every system. So we emulate it. --- diff --git a/boot.php b/boot.php index 57414e8fcf..a4e2cfe4e5 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); + } +}