[eluser]Thorpe Obazee[/eluser]
This is my method for uploading and then resizing. However, I need to get the name of the thumb image. How do I dynamically get the new name of the thumb image? Is there a function to get this in the image library? of course aside from doing the rename() php function.
Code:
function _upload_pics()
{
if ($_FILES)
{
$config = array(
'upload_path' => './uploads/',
'allowed_types' => 'gif|jpg|png',
'max_size' => '100',
'max_width' => '400',
'max_height' => '400'
);
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
return FALSE;
}
else
{
$this->file = $this->upload->data();
$config = array(
'image_library' => 'gd2',
'source_image' => './uploads/'.$this->file['file_name'],
'create_thumb' => TRUE,
'maintain_ratio' => TRUE,
'width' => 120,
'height' => 120,
'new_image' => './uploads/thumb/'.$this->file['file_name']
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
return TRUE;
}
} // if $_FILES
}// End upload_pics