hi guys, I’ve got a problem when I’m trying to load several files and then to process them with library(‘image_lib’). The goal is - user downloads 3 files(photos) with any size, then program processes them and compress to the following size/quality and save in a folder. So when I do that- program saves 3 initial user’s files and then create only one compressed copy insted of 3. I tried to resolve that problem all the day long but without any result. Attach the following code.
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['file_name'] = 'pic';
$this->load->library('upload', $config);
$this->upload->do_upload('image_name');
$arr1=$this->upload->data();
$config = array(
'image_library' => 'gd2',
'quality' => '50',
'source_image' => $arr1['full_path'],
'new_image' => './images/i',
'maintain_ratio' => true,
'create_thumb' => false,
'width' => 700,
'height' => 500
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['file_name'] = 'pic2';
$this->load->library('upload', $config);
$this->upload->do_upload('image_name2');
$arr2=$this->upload->data();
$config = array(
'image_library' => 'gd2',
'quality' => '50',
'source_image' => $arr2['full_path'],
'new_image' => './images/i',
'maintain_ratio' => true,
'create_thumb' => false,
'width' => 700,
'height' => 500
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$config['upload_path'] = './images/';
$config['allowed_types'] = 'gif|jpg|png';
$config['file_name'] = 'pic3';
$this->load->library('upload', $config);
$this->upload->do_upload('image_name3');
$arr3=$this->upload->data();
$config = array(
'image_library' => 'gd2',
'quality' => '50',
'source_image' => $arr3['full_path'],
'new_image' => './images/i',
'maintain_ratio' => true,
'create_thumb' => false,
'width' => 700,
'height' => 500
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.