[eluser]Thiago Leao[/eluser]
Code:
<?php
class Upload extends Controller {
function go() {
if(isset($_POST['upload'])) {
$config['upload_path'] = realpath('assets/uploads/');
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['remove_spaces'] = TRUE;
$config['encrypt_name'] = TRUE;
$config['max_size'] = '8192'; // 8Mbs
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->upload->do_upload();
$image_data = $this->upload->data();
$configLarge = array(
'source_image' => $image_data['full_path'],
'new_image' => realpath('assets/uploads/large/'),
'master_dim' => 'auto',
'maintain_ratio' => true,
'width' => 800,
'height' => 600
);
$this->load->library('image_lib');
$this->image_lib->initialize($configLarge);
$this->image_lib->resize();
$this->image_lib->clear();
$configThumb = array(
'source_image' => $image_data['full_path'],
'new_image' => realpath('assets/uploads/thumb/'),
'maintain_ratio' => true,
'master_dim' => 'auto',
'width' => 150,
'height' => 150
);
$this->image_lib->initialize($configThumb);
$this->image_lib->resize();
}
}
}
?>
Well I could but it's missing a detail.
When I send a picture, it creates 3 files, a large folder in another folder and thumb, and another in the folder uploads / What is the original.
How do I delete the original, so that when it generates a large and thumb?