From: Joe Hunt Date: Wed, 3 Aug 2011 22:00:38 +0000 (+0200) Subject: Added support for png and gif item images. Rerun. X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=15ac8be8c72b0a2d4a3c3d5fc59dc5ccfe68e6a0;p=textcart.git Added support for png and gif item images. Rerun. --- diff --git a/company/0/images/102.jpg b/company/0/images/102.jpg index a7cfb14..479662e 100644 Binary files a/company/0/images/102.jpg and b/company/0/images/102.jpg differ diff --git a/inventory/manage/items.php b/inventory/manage/items.php index b214b7d..8d65397 100644 --- a/inventory/manage/items.php +++ b/inventory/manage/items.php @@ -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';