Peter - 2007-06-20 09:54:09
In my projects I use the imagecreatefrom functions in order to secure the image upload process:
if (function_exists("imagecreatefromgif")) {
switch($image_ext) {
case 'gif' : $im = @imagecreatefromgif($image_path); break;
case 'jpg': $im = @imagecreatefromjpeg($image_path); break;
case 'png': $im = @imagecreatefrompng($image_path); break;
}
if ($im) { imagedestroy($im); $is_image = true; }
else { $is_image = false; }
}