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

[eluser]3rdear[/eluser]
I have an upload form and controller most of which was copied straight from the user guide. The difference is that I've added some directory creation and image resizing based upon the user doing the upload and the problem comes at the resizing part. Here's the code:
Code:
$upload_path='images/user_images/'.$this->session->userdata('id').'/';
$upload_data=$this->upload->data();

// create the thumbnail
$config['image_library'] = 'gd2';
$config['source_image'] = $upload_path.$upload_data['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 100;

$this->load->library('image_lib',$config);
$this->image_lib->resize();
$this->image_lib->clear();

//resize the original  
$config['image_library'] = 'gd2';
$config['source_image'] = $upload_path.$upload_data['file_name'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 600;
$config['height'] = 600;

$this->load->library('image_lib',$config);
$this->image_lib->resize();
$this->image_lib->clear();

Now, here's the problem. The code looks right to me, but the resizing of the original image never happens. If I switch the $config code blocks around, the original gets resized, but the thumbnail doesn't get created. It's as if the process is completely missing the second resize operation no matter which one it is. Any help here?
#2

[eluser]3rdear[/eluser]
Nevermind. It's amazing what you'll find if you just search the forum a bit. Didn't have
Code:
$this->image_lib->initilaize($config);
I'm good to go!




Theme © iAndrew 2016 - Forum software by © MyBB