[eluser]reyntjensw[/eluser]
What will happen with the original file (when a file is being uploaded)? Is it being used or being removed?
I'm trying to remove the original file, because I'm not going to use it.
All of the resizing is going fine, but the removal of the original file is a pain in the ***.
Does the upload library has some magic function not to create an original file?
Code:
$config['upload_path'] = realpath(APPPATH . "../images/photoalbum/");
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '10000';
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->upload->do_upload();
$file_data = $this->upload->data();
$data = array(
'photoalbum_category_id' => $this->input->post("photoalbum_category_id"),
'description' => $this->input->post("description"),
'file_name' => $file_data['file_name']
);
$this->photoalbum_model->insert($data);
$dbArr['cat'] = $this->photoalbum_category_model->get_all();
$maxID = $this->photoalbum_model->getMax();
foreach ($maxID->result() as $row) {
$highestID= $row->id;
}
$thumb_name = $highestID.$file_data['raw_name']."-thumb".$file_data['file_ext'];
$big_name = $highestID.$file_data['raw_name'].$file_data['file_ext'];
$echt = $file_data['full_path'];
$config = array(
'image_library' => 'gd2',
'source_image' => $file_data['full_path'],
'new_image' => realpath(APPPATH . "../images/photoalbum/"),
'maintain_ration' => true,
'width' => 450,
'height' => 500,
'new_image' => $big_name
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
echo $this->image_lib->display_errors();
$config = array(
'image_library' => 'gd2',
'source_image' => $file_data['full_path'],
'new_image' => realpath(APPPATH . "../images/photoalbum/thumbs/"),
'maintain_ration' => true,
'width' => 150,
'height' => 100,
'new_image' => $thumb_name
);
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
Thanks