CodeIgniter Forums

Full Version: Upload...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hello all.
I have the function upload:

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";
            $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;
                $config['x_axis'] = 0;
                $config['y_axis'] = ($height-$width)/2;
                $config['height'] = $width;
                $config['width'] = $width;
                $config['y_axis'] = 0;
                $config['x_axis'] = ($width-$height)/2;
                $config['height'] = $height;
                $config['width'] = $height;
            $this->load->library('image_lib', $config);
            $config['maintain_ratio'] = FALSE;
            $config['height'] = 60;
            $config['width'] = 60;

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

Any help?

El Forum

Do you get any error messages? Enable logging.

You should also call


User guide:
Quote:The clear function resets all of the values used when processing an image. You will want to call this if you are processing images in a loop.

El Forum

You might also try this out on a regular image you upload with hard-coded address, and maybe you can whittle-down where the problem is a bit better.

From the manual it recommends:

if ( ! $this->image_lib->resize())
    echo $this->image_lib->display_errors();
} display errors.