[eluser]davehedgehog[/eluser]
Hey, uh wonder if anyone could help? Im trying to upload an image and then create a smaller image and a thumb and store them in separete folders. As it stands the main image uploads but the smaller onse dont, shouldnt the image resize store the images to the new path?
Here is my do_upload in the controller~
Code:
public function do_upload()
{
$this->load->library('image_lib');
$config['upload_path'] = './uploads/blog/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '4442048';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$this->form_validation->set_message('do_upload', $this->upload->display_errors(), 'Dodgy Blog entry :/');
return FALSE;
}
else
{
$data = array('upload_data' => $this->upload->data());
$config['image_library'] = 'gd2';
$config['source_image'] = $data['Image'];
$config['new_image'] = './uploads/blog/last/';
$config['create_thumb'] = 'TRUE';
$config['maintain_ratio'] = 'TRUE';
$config['width'] = '400';
$config['height'] = '300';
$this->load->initialize($config);
$this->image_lib->resize();
$config['image_library'] = 'gd2';
$config['source_image'] = $data['Image'];
$config['new_image'] = './uploads/blog/thumb/';
$config['create_thumb'] = 'TRUE';
$config['maintain_ratio'] = 'TRUE';
$config['width'] = '36';
$config['height'] = '36';
$this->load->initialize($config);
$this->image_lib->resize();
if ( ! $this->image_lib->resize())
{
echo $this->image_lib->display_errors();
$this->session->set_flashdata('flashError', 'No smaller images stored :/');
}
}
}