Welcome Guest, Not a member yet? Register   Sign In
Image library not loading.
#1

[eluser]mak.gnu[/eluser]
Hi,
I'm not able to load the Image library following is my function, I'm trying to load the library in my model's function and I'm using Datamapper library too.

Code:
public function create_thumb() {
        $config['image_library'] = 'gd2';
        $config['source_image'] = $this->data['full_path'];
        $config['new_image'] = $this->image_path;
        $config['create_thumb'] = TRUE;
        $config['maintain_ratio'] = TRUE;
        $config['thumb_marker'] = "";
        switch ($this->image_type) {
            case 'thumb':

                $config['width'] = 90;
                $config['height'] = 90;
                break;
            case 'medium':
                $config['width'] = 330;
                $config['height'] = 250;
                break;
            case 'logo':
                $config['width'] = 167;
                $config['height'] = 133;
                break;

            default:
                $config['width'] = 640;
                $config['height'] = 480;
                unset($config['new_image']);
                break;
        }
        $this->load->library('image_lib');
        $this->image_lib->clear();
        $this->image_lib->initialize($config);
        if (!$this->image_lib->resize()) {
            $this->upload_error = $this->image_lib->display_errors();
            $this->image_lib->clear();
            return false;
        } else {
            return $this->data;
        }
    }

when this function runs I get "Call to a member function clear() on a non-object" Image_lib do exist in system/libraries folder




Theme © iAndrew 2016 - Forum software by © MyBB