if(!$this->upload->do_upload())
{
//echo $config['upload_path'];
$error = $this->upload->display_errors();
echo $error.':err'; //pagal galune .err javasctriptas atskirs kad cia klaida
}
else
{
$data = $this->upload->data();
$this->load->model('Image_model','image');
if($data['image_width'] > 700)
{
$task = $this->image->image_resize_for_gallery('./uploads/gallery/'.$this->input->post('album_folder').'/'.$data['file_name']);
if($task != 'ok')
{
echo $task.':err'; //pagal galune .err javasctriptas atskirs kad cia klaida
}
}
if($this->image->gallery_thumb($this->input->post('album_folder'),$data['file_name']))
{
$this->image->gallery_enter_image($data['file_name'],$this->input->post('album_folder'));
echo $data['file_name'];
}
else
{
echo 'Nepavyko įkelt mažos nuotraukytes:err';
}
}
When image_width > 700 then thumbnail is not created.
So how this part
if($data['image_width'] > 700)
{
$task = $this->image->image_resize_for_gallery('./uploads/gallery/'.$this->input->post('album_folder').'/'.$data['file_name']);
if($task != 'ok')
{
echo $task.':err'; //pagal galune .err javasctriptas atskirs kad cia klaida
}
}
can change anything? It looks that it just does what it has to do - makes image smaller. And I made console.log in javascript and it does not show any error..
Nothing fancy in image resize function:
function image_resize_for_gallery($source_image)
{
$config['image_library'] = 'gd2';
$config['source_image'] = $source_image;
$config['maintain_ratio'] = TRUE;
$config['width'] = 534;
$config['height'] = 700;
$this->load->library('image_lib', $config);
if ( ! $this->image_lib->resize())
{
return $this->image_lib->display_errors();
}
else return 'ok';
}