Welcome Guest, Not a member yet? Register   Sign In
multiple image resizing for multiple file upload (Resizing many originals all at once)
#1

[eluser]e-nigma[/eluser]
please see thread multiple file uploads with thumb creation.
#2

[eluser]vitoco[/eluser]
isn't a solution to put the call inside a loop?, maybe ..
Code:
foreach( $_FILES as $file )
{
    // check if the type of file is iamge
    if( $is_image )
    {
       // do the process of resize / create thumb
    }
}

Saludos
#3

[eluser]Stefan Hueg[/eluser]
Please don't repost and stick to your topic instead.
If you need it so desperately just bump your old topic up:

http://ellislab.com/forums/viewthread/216242/
#4

[eluser]e-nigma[/eluser]
[quote author="vitoco" date="1335815870"]isn't a solution to put the call inside a loop?, maybe ..
Code:
foreach( $_FILES as $file )
{
    // check if the type of file is iamge
    if( $is_image )
    {
       // do the process of resize / create thumb
    }
}

Saludos[/quote]

No I'm not using $_FILES in this case for security reasons. However I did try the following:

public function do_upload()
{

$this->form_validation->set_rules('userfile','userfile','trim|xss_clean');
$this->form_validation->set_rules('btn_upload','btn_upload','trim|xss_clean');

$c_upload['upload_path'] = $this->data['dir']['original'];
$c_upload['allowed_types'] = 'gif|jpg|png|jpeg|x-png';
$c_upload['max_size'] = '3500';
$c_upload['max_width'] = '3600';
$c_upload['max_height'] = '1200';
$c_upload['remove_spaces'] = TRUE;

$this->load->library('upload', $c_upload);
$data = $this->load->library('Multi_upload');

$files = $this->multi_upload->go_upload();

if (!$files)
{
$error = array('error' => $this->upload->display_errors());
redirect(base_url().'index.php/dyng/index/');
}
else
{
$data = array('upload_data' => $files);
$file = array();
$file = $this->upload->data();
$files = $file['file_name'];
$fields = array(
'files' => $files[$i]);

for($i = 0; $i < count($files); $i++) {

$data['image'] = $this->data['dir']['original'].$files[$i];

$new_image = $this->data['dir']['thumb'].'thumb_'.$files[$i];

$c_img_lib = array(
'image_library' => 'gd2',
'source_image' => $data['image'],
'create_thumb' => TRUE,
'maintain_ratio' => TRUE,
'width' => 100,
'height' => 100,
'new_image' => $new_image
);

$this->load->library('image_lib', $c_img_lib);
$this->image_lib->initialize($c_img_lib);
$this->image_lib->resize();
$this->image_lib->clear();
}
redirect(base_url().'index.php/dyng/do_upload/');

}
}




Theme © iAndrew 2016 - Forum software by © MyBB