Codeigniter图像上传图像(某些图像上下颠倒)

I got a weird problem when uploading images via "upload" library.

When i have huge pics, like 1,8mb big it always uploads them upside down.

Otherwise it gets uploaded normally.

my model for upload looks like this

function do_upload() {

    $this->gallery_path = realpath(APPPATH . '../public/images');

    $config = array(
        'upload_path' => $this->gallery_path,
        'allowed_types' => 'jpg|jpeg|gif|png',
        'max_size' => 2000
    );

    $this->load->library('upload',$config);
    $this->upload->do_upload();
    $image_data = $this->upload->data();

    //to db
    $filename=$image_data['file_name'];

    $this->db->set('name', $filename);
    $this->db->insert('images');

}

could anyone please just explain why it gets like this? I've tried to increase max size to see if it would help but it didn't.

Would be more than thankful for some help :)

Try setting your config for upload:

$config['max_size'] = 0;