[eluser]recoilme[/eluser]
inparo - right.
My problem was in gd2 and in wrong full path (for me). And wrong CI error reporting)
its work for me now:
Code:
function _upload_image($_FILES)
{
$this->load->library('upload');
$this->load->library('image_lib');
$config['upload_path'] = 'data/img/';
$config['allowed_types'] = 'jpg|jpeg|gif|avi';
$config['encrypt_name'] = 'TRUE';
$this->upload->initialize($config);
if ( ! $this->upload->do_upload()){
$error = array('error' => $this->upload->display_errors());
show_error($error);
}
$resarr = $this->upload->data();
$file = $resarr['file_name'];
if($file != '' and ($resarr['image_width']>780 or $resarr['image_height']>780) ){
$config['image_library'] = 'GD2';
$config['source_image'] = $resarr['full_path'];
$config['maintain_ratio'] = TRUE;
$config['width'] = 780;
$config['height'] = 780;
$config['master_dim'] = 'width';
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize()){
$error = array('error' => $this->image_lib->display_errors());
show_error($error);
}
$resarr['image_size_str'] = "width=\"780\"";
}
$upl = array();
$upl = $resarr;
return $upl;
}