Welcome Guest, Not a member yet? Register   Sign In
Image resizing [ The path to the image is not correct.]
#2

[eluser]BrianDHall[/eluser]
Well, two things - the path isn't right, and it doesn't seem your server supports the GD function which is the PHP extension module that handles image resizing - so you have two issues going on.

The first change is try using existing path data for your resize function as provided by the image upload class, as such:

Code:
function do_upload
{
    $num=7; //for user_id        
    $config['upload_path'] = './images/';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['overwrite']=TRUE;
    $config['max_size']    = '100';
    $config['max_width']  = '1024';
    $config['max_height']  = '768';
    $config['file_name']='avatar_'.$num;
    
    $iconfig['image_library'] = 'GD2'; //i also wrote GD/gd2
    
    $iconfig['create_thumb'] = TRUE;
    //$iconfig['maintain_ratio'] = TRUE;
    $iconfig['width']     = 70;
    $iconfig['height']    = 90;
  
    
    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());
        
        $this->load->view('upload_form', $error);
    }    
    else
    {
        $data = array('upload_data' => $this->upload->data());
        
        $this->load->view('upload_success', $data);
        
        $this->load->library('image_lib');
        $iconfig['source_image']=$data['upload_data']['full_path'];
        $this->image_lib->initialize($iconfig);

        if ( ! $this->image_lib->resize())
            {
                echo $this->image_lib->display_errors();
            }
    }

}


Messages In This Thread
Image resizing [ The path to the image is not correct.] - by El Forum - 10-23-2009, 10:43 AM
Image resizing [ The path to the image is not correct.] - by El Forum - 10-23-2009, 11:10 AM
Image resizing [ The path to the image is not correct.] - by El Forum - 10-23-2009, 01:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB