Added support for png and gif item images. Rerun.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 3 Aug 2011 22:00:38 +0000 (00:00 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Wed, 3 Aug 2011 22:00:38 +0000 (00:00 +0200)
company/0/images/102.jpg
inventory/manage/items.php

index a7cfb140bc033ba4350a33e5d135be4b21edce88..479662ea79efd5d880d04faf4948af4ddf2d2c9c 100644 (file)
Binary files a/company/0/images/102.jpg and b/company/0/images/102.jpg differ
index b214b7d8a88ca4649a7e6ad95a753cf139c25d4c..8d65397e5fbe609921a1a3b638acc74cdc752a90 100644 (file)
@@ -64,13 +64,17 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
        $filename .= "/".item_img_name($stock_id).".jpg";
        
        //But check for the worst 
-       $imagetype = exif_imagetype($_FILES['pic']['tmp_name']);
+       if ((list($width, $height, $type, $attr) = getimagesize($_FILES['pic']['tmp_name'])) !== false)
+               $imagetype = $type;
+       else
+               $imagetype = false;
+       //$imagetype = exif_imagetype($_FILES['pic']['tmp_name']);
        if ($imagetype != IMAGETYPE_GIF && $imagetype != IMAGETYPE_JPEG && $imagetype != IMAGETYPE_PNG)
        {       //File type Check
                display_warning( _('Only graphics files can be uploaded'));
                $upload_file ='No';
        }       
-       elseif (strtoupper(substr(trim($_FILES['pic']['name']), in_array(strlen($_FILES['pic']['name']) - 3)), array('JPG','PNG','GIF')))
+       elseif (@strtoupper(substr(trim($_FILES['pic']['name']), @in_array(strlen($_FILES['pic']['name']) - 3)), array('JPG','PNG','GIF')))
        {
                display_warning(_('Only graphics files are supported - a file extension of .jpg, .png or .gif is expected'));
                $upload_file ='No';