[eluser]the_unforgiven[/eluser]
write_file() helper not what i was after.
I have this code
Code:
function _do_upload_file()
{
//upload path and config
$config = array(
'allowed_types' => 'jpg|jpeg|gif|png',
'upload_path' => $this->gallery_path,
'max_size' => 3000,
'overwrite' => false,
'remove_spaces' => true
);
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload())
{
$this->form_validation->set_message('_do_upload_file', $this->upload->display_errors());
return FALSE;
}
else
{
$config = array(
'image_library' => 'gd2',
'create_thumb' => TRUE,
'source_image' => $this->upload->upload_path.$this->upload->file_name,
'new_image' => $this->gallery_path . '/thumbs',
'maintain_ration' => true,
'width' => 150,
'height' => 100
);
$this->load->library('image_lib', $config);
if (!$this->image_lib->resize()){
$this->form_validation->set_message('_do_upload_file', $this->image_lib->display_errors());
}
}
}
Which currently uploads files to assets/uploads/userfiles/imagename.jpg for example but now the code above should resize the image uploaded adn then place into a folder called thumbs inside assets/uploads/userfiles/thumbs for instance is what I have setup, can any one help me on this?
Have I missed something or done something wrong?