[eluser]kbauman[/eluser]
Well, I found a few mistakes that apparently still worked in 1.7.1, but not in 1.7.2. I was running the upload, resize, and crop actions twice. Once removed, the images had the correct name, however now the resize does not work. No errors are returned. It simply stops at:
Code:
$this->image_lib->resize()
If I remove the code that specifies the size everything works, other than the obvious fact that the image never gets resized. Any help would be appreciated.
Code:
function modify_page(){
$this->load->helper('file');
$this->load->library('image_lib');
$page = $this->uri->segment(3, 0);
$id = $this->input->post('id');
$photo_id = $this->input->post('photo_id');
$photo_title = $this->input->post('photo_title');
////if a new image has been uploaded
if((isset($_FILES['image']['name'])) && ($_FILES['image']['name'] != ''))
{
$image = str_replace(" ", "_", $_FILES['image']['name']);
$photo_id = $this->pages_model->insertPagePhoto($this->input->post('photo_title'), $image);
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '0';
$config['max_width'] = '1000';
$config['max_height'] = '1000';
$config['overwrite'] = 'FALSE';
$config['remove_spaces'] = 'TRUE';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('image'))
{
$message['upload'] = $this->upload->display_errors();
}
else
{
$message['upload'] = $this->upload->data();
}
$up_data = $this->upload->data();
$up_data['image_library'] = 'GD2';
$up_data['source_image'] = $up_data['full_path'];
$config2 = $up_data;
$config3 = $config2;
$config2['new_image'] = './images/pages/'.$up_data['file_name'];
$config2['quality'] = '100%';
$config2['maintain_ratio'] = TRUE;
if( ( $up_data['image_width'] > 400 ) || ( $up_data['image_height'] > 400 ) ) {
$config2['width'] = 400;
$config2['height'] = 400;
}
$this->image_lib->initialize($config2);
if ( ! $this->image_lib->resize())
{
$message['resize'] = $this->image_lib->display_errors();
}
else
{
$message['resize'] = $up_data['file_name'];
}
$config3['new_image'] = './images/pages/thumbs/'.$up_data['file_name'];
$config3['quality'] = '100%';
$config3['maintain_ratio'] = TRUE;
$config3['width'] = 100;
$config3['height'] = 100;
$this->image_lib->initialize($config3);
if ( ! $this->image_lib->resize())
{
$message['thumb'] = $this->image_lib->display_errors();
}
else
{
unlink($up_data['full_path']);
$message['thumb'] = $up_data['file_name']." thumbnail";
}
}
if($id == '')
{
$display_order = $this->pages_model->countPages();
$display_order = $display_order + 1;
$this->pages_model->createPage($display_order, $photo_id);
$this->db->set('content', $this->input->post('info'));
$this->db->insert('pages');
}
else
{
$this->pages_model->modifyPage($id, $photo_id);
$this->pages_model->modifyPhotoTitle($photo_id, $photo_title);
}
redirect('admin/pages/'.$page);
}