Welcome Guest, Not a member yet? Register   Sign In
Image Resizing problem
#1

[eluser]aruntvla[/eluser]
Images showing a background border when resizing........and resizing not doing correctly...........


Model Upload and Resize function


Code:
function do_user_upload($field)
    {
        
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']    = '0';
        $config['max_width']  = '0';
        $config['max_height']  = '0';
        //print_r($config);
        $this->load->library('upload', $config);
        if ( ! $this->upload->do_upload($field))
        {
            $error = array('error' => $this->upload->display_errors());
            echo  $this->upload->display_errors() ;

        }
        else
        {
            $data = array('upload_data2' => $this->upload->data());
            //print_r($data);
            unset($config);
            $config['image_library'] = 'gd2';
            echo "image name is".$data['upload_data2']['file_name'];
            $config['source_image'] = './uploads/'.$data['upload_data2']['file_name'];
           // $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 544;
            $config['height'] = 256;
            $config['quality'] = 100;
            $config['master_dim'] = 'auto';
            
            
            //print_r($config);

                 $this->load->library('image_lib', $config);
              $dataresize = $this->image_lib->resize();
              print_r($dataresize);
              // echo var_dump(gd_info());
              // $datas = array('message' =>var_dump($this->upload->data()));  
            // $datas = array('resize_data' => $this->image_lib->resize());
             $datas = array('upload_data2' => $this->upload->data());
            
            // $logo =  $data['upload_data']['file_name'];
            // echo $logo;
            //rename($data['full_path'],'./uploads/'.$newimagename);
            //$pic = realpath('./uploads/'.$newimagename);
            unset($config);
            $this->image_lib->clear();
            
            return $datas;
        }
        
    }


********************Call from Controller Page*******************



Code:
if($_FILES['fileToUpload']['error'] < 1 )
                  {
                  $field_name = "fileToUpload";
                  $datas = $this->user_createcoupon_model->do_user_upload($field_name);
                   $userimage =  $datas['upload_data2']['file_name'];
                  }


*********************************************************************************

But this resize function dont affecting the image size.....i dont know why this....thre is allready another function for to upload and watermark..........please give me an idea..........




Theme © iAndrew 2016 - Forum software by © MyBB