The resize function below doesn't work. But if I comment the create thumbnail, the resize line works !!. Why it likes that ?
if ($this->form_validation->run()) {
$path = 'dist/img/product/';
$thumbnail_renamed = $this->rename_file($_FILES['thumbnail']['name']);
/// Upload image first
if ($this->upload_file('thumbnail', $path, '', '', array('file_name' => $thumbnail_renamed))) {
/// Create thumbnail
$this->_createThumbnail($path . $thumbnail_renamed, '225', '150');
/// if photo 2 is not null
if (!empty($_FILES['photo2']['name'])) {
// Renamed file firstly
$photo2_renamed = $this->rename_file($_FILES['photo2']['name']);
// start upload
if ($this->upload_file('photo2', $path, '', '', array('file_name' => $photo2_renamed))) {
// resize image
$this->resize_image($path.$photo2_renamed,'600');
} else {
$this->session->set_flashdata('message', $this->my_fun->alert('danger', $this->upload->display_errors()));
}
}
} else {
$this->session->set_flashdata('message', $this->my_fun->alert('danger', $this->upload->display_errors()));
}
} else {
$this->session->set_flashdata('message', $this->my_fun->alert('danger', validation_errors()));
}