Welcome Guest, Not a member yet? Register   Sign In
Image upload/manipulation error?
#1

[eluser]feri_soft[/eluser]
Hello,
I have the following code for uploading, creating a thumb and watermarking an image:

Code:
if(!empty($_FILES)){
                $num_files = count($_FILES);
                $config['upload_path'] = 'S:/xampp/htdocs/asdasdasd';
                $config['allowed_types'] = 'jpg';
                $config['max_width'] = '800';
                $config['max_height'] = '600';
                $this->load->library('upload', $config);
                for($i = 1; $i <= $num_files; $i++){
                    $field_name = 'file_' . $i;
                    $this->upload->do_upload($field_name);
                    $upload_data = $this->upload->data();
                    $new_file = $upload_data['file_path'] . $product_id . '_' . $i . '.jpg';
                    rename($upload_data['full_path'], $new_file);
                    
                    $config1['image_library'] = 'GD';
                    $config1['source_image'] = $new_file;
                    $config1['create_thumb'] = TRUE;
                    $config1['maintain_ratio'] = FALSE;
                    $config1['width'] = '80';
                    $config1['height'] = '60';
                    $config1['wm_type'] = 'overlay';
                    $config1['wm_vrt_alignment'] = 'bottom';
                    $config1['wm_hor_alignment'] = 'right';
                    $config1['wm_overlay_path'] = 'S:/xampp/htdocs/asdasdasd/w.png';

                    $this->load->library('image_lib', $config1);

                    $this->image_lib->resize();
                    $this->image_lib->watermark();
                }
                
            }
I have a javascript upload script which create multiple upload fields with names like file_1 , 2 , 3 etc. and this is the code i have came up with. The problem is that when i upload multiple files it creates only 1 and it cant find the next in my upload forlder to rename and process it!?!? And the other issue is that the thumnailer doesnt thumbnail my pics! All my pics remain 800/600 px but the thumnailed has watermark on it and the other doesnt. Please help because everything is wrong here. Whats not correct in the script or maybe the problem is in my html/js. Thanks!
#2

[eluser]ELRafael[/eluser]
try to use this
http://ellislab.com/forums/viewthread/61818/

I had a very similar problem.... Maybe your error is in
Code:
$this->image_lib->initialize($config_var);




Theme © iAndrew 2016 - Forum software by © MyBB