[eluser]emperius[/eluser]
I have few fields for uploading files.
And when I'm uploading 1 file resize works great, but when I'm uploading few files images are not resized or I get a black square
here is my code
Code:
if(!empty($_FILES))
{
foreach($_FILES as $key => $value)
{
if(!empty($value['name']))
{
$field = $key;
$config['upload_path'] = realpath('public/object');
$config['allowed_types'] = 'jpg|jpeg|gif|avi';
$config['encrypt_name'] = 'TRUE';
$this->load->library('upload', $config);
$this->upload->do_upload($field);
$resarr = $this->upload->data();
$file = $resarr['file_name'];
if($file != '')
{
$oldpath = realpath("public/object")."/".$file;
$fpath = realpath("public/object/thumbs")."/".$file;
if (!copy($oldpath, $fpath))
{
echo "error copy";
}
else
{
$config['image_library'] = 'GD2';
$config['source_image'] = $fpath;
$config['maintain_ratio'] = TRUE;
$config['width'] = 150;
$config['height'] = 110;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
echo $this->image_lib->display_errors();
}
}
echo $this->upload->display_errors();
}
}
}