Welcome Guest, Not a member yet? Register   Sign In
Multiple image upload, resizes only once
#1

[eluser]Kristof[/eluser]
Code:
function upload_array_files()
        {
            // settings
            $config['upload_path']      = './uploads/';
            $config['allowed_types'] = 'gif|jpg|jpeg|png';
            $config['max_size'] = '1000';
            $config['max_width'] = '1920';
            $config['max_height'] = '1280';    
            
            $this->load->library('upload',$config);
            
            
        if(!$this->upload->do_upload('files')){
            echo $this->upload->display_errors();
        }
        else {
            $fInfo = $this->upload->data();
            #echo '<pre>'; print_r($fInfo); echo '</pre>'; // defaul
            for($i=0;$i<count($fInfo['file_name']);$i++){
                
                echo '$i = '.$i.'filename = '.$fInfo['file_name'][$i].'<br/>';
                $this->_createThumbnail($fInfo['file_name'][$i]);
            }
        }
    
        }
        function _createThumbnail($fileName) {
            //settings
            $config['image_library'] = 'gd2';
            $config['source_image'] = './uploads/' . $fileName;    
            $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 75;
            $config['height'] = 75;
            
            $this->load->library('image_lib', $config);        
            if(!$this->image_lib->resize()) echo $this->image_lib->display_errors();
                  
        }
The upload works great, 1 or 3 files, works fine but
he only does the _createThumbnail once (on the first file) and i don't see why, the echo is correct though. Anyone has an idea ?

thanks in advance


Messages In This Thread
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 06:13 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 06:30 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 06:59 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 07:45 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 09:02 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 09:25 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 10:00 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 10:05 AM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 12:54 PM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 02:36 PM
Multiple image upload, resizes only once - by El Forum - 09-22-2009, 02:51 PM
Multiple image upload, resizes only once - by El Forum - 09-23-2009, 04:58 AM
Multiple image upload, resizes only once - by El Forum - 05-03-2010, 08:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB