hamed86 Posted August 15, 2010 Share Posted August 15, 2010 hi, I have problems when people upload pictures to my page, some images are only half, see example. http://photoagahi.com/advert/detail/------92733 this is how the code looks like: if ( ! function_exists('upload')) { function upload($post_field, $folder = DEFAULT_ADVERT_IMAGE_FOLDER) { $config['upload_path'] = $folder; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '5000'; $config['encrypt_name'] = true; $config['remove_spaces'] = true; $CI =& get_instance(); $CI->load->library('upload'); $CI->load->library('image_lib'); $CI->load->library('image_lib', null, 'secondary_image_lib'); $CI->upload->initialize($config); if(!$CI->upload->do_upload($post_field)) return $CI->upload->display_errors(); $data = $CI->upload->data(); $thumb['source_image'] = DEFAULT_ADVERT_IMAGE_FOLDER.$data['file_name']; $thumb['width'] = 80; $thumb['height'] = 60; $thumb['create_thumb'] = true; $thumb['maintain_ratio'] = true; $CI->image_lib->initialize($thumb); $thumb_result = true; if(!$CI->image_lib->resize()) $thumb_result = $CI->image_lib->display_errors(); $img_data = getimagesize(DEFAULT_ADVERT_IMAGE_FOLDER.$data['file_name']); if($img_data[0] > 620 || $img_data[1] > 480) { $orig['source_image'] = DEFAULT_ADVERT_IMAGE_FOLDER.$data['file_name']; $orig['maintain_ratio'] = true; $orig['width'] = 620; $orig['height'] = 480; $CI->secondary_image_lib->initialize($orig); $orig_result = true; if(!$CI->secondary_image_lib->resize()) $orig_result = $CI->secondary_image_lib->display_errors(); if($orig_result !== true) return $orig_result; $new_size = getimagesize(DEFAULT_ADVERT_IMAGE_FOLDER.$data['file_name']); if($new_size) { $data['image_width'] = $new_size[0]; $data['image_height'] = $new_size[1]; } } if($thumb_result === true) { $data['file_thumb_data'] = file_get_contents(DEFAULT_ADVERT_IMAGE_FOLDER.$data['raw_name'].'_thumb'.$data['file_ext']); $data['file_data'] = file_get_contents($data['full_path']); return $data; } else return $thumb_result; } } Quote Link to comment Share on other sites More sharing options...
visualazza Posted August 15, 2010 Share Posted August 15, 2010 are you saying the images get cut off on some of them. If so are you sure thats not just how they were taken Quote Link to comment Share on other sites More sharing options...
hamed86 Posted August 15, 2010 Author Share Posted August 15, 2010 yes thats what Im saying, and no thats not the case because if you se the thumb pics on the left you can se the hole pic. and I have tried it myself. I think i have missed something in the code :S Quote Link to comment Share on other sites More sharing options...
visualazza Posted August 15, 2010 Share Posted August 15, 2010 sorry to say, but from my end, what the thumb picture is is EXACTLY the same as whats being shown on the larger image. Quote Link to comment Share on other sites More sharing options...
hamed86 Posted August 15, 2010 Author Share Posted August 15, 2010 hi, click on the 3:rd thumb pic, the first and second one is looking good but the 3:rd is cut half Quote Link to comment Share on other sites More sharing options...
visualazza Posted August 16, 2010 Share Posted August 16, 2010 again not from my pc Ive tested with firefox, ie, safari, chrome and opera and nothing is wrong. The large pic is the same as the thumb pic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.