• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload...

#1
[eluser]danielbertini[/eluser]
Hello all.
I have the function upload:

Code:
function upload(){
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size']  = '10000';
        $config['max_width']  = '2000';
        $config['max_height']  = '2000';
        $config['encrypt_name'] = TRUE;
        $config['remove_spaces'] = TRUE;
        $this->load->library('upload', $config);
        if (!$this->upload->do_upload()){
            echo "error";
        }
        else{
            $data = array('upload_data' => $this->upload->data());
            $upload_data = $this->upload->data();
            $width = $upload_data['image_width'] ;
            $height = $upload_data['image_height'];
            $config['image_library'] = 'gd';
            $config['source_image'] = './uploads/'.$upload_data['file_name'];
            $config['maintain_ratio'] = FALSE;
            $config['quality'] = 100;
            if($height>$width){
                $config['x_axis'] = 0;
                $config['y_axis'] = ($height-$width)/2;
                $config['height'] = $width;
                $config['width'] = $width;
            }
            else{
                $config['y_axis'] = 0;
                $config['x_axis'] = ($width-$height)/2;
                $config['height'] = $height;
                $config['width'] = $height;
            }
            $this->load->library('image_lib', $config);
            $this->image_lib->crop();
            $config['maintain_ratio'] = FALSE;
            $config['height'] = 60;
            $config['width'] = 60;
            $this->image_lib->initialize($config);
            $this->image_lib->resize();    
        }
    }

Function upload work but dont resize or crop just only upload...
Using Leopard + Mamp + http://valums.com/ajax-upload/
In phpinfo GD library is active, and i use captcha without problems...

Any help?
thanks!


Messages In This Thread
Upload... - by El Forum - 09-03-2009, 10:26 AM
Upload... - by El Forum - 09-03-2009, 01:46 PM
Upload... - by El Forum - 09-03-2009, 02:45 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.