taek
taek

Reputation: 1119

Error resizing image with codeigniter

i have a problem with resizing image in CI ( i'm new to CI by the way ). so here is my code :

    $config['image_library'] = 'gd2';
    $config['source_image'] = base_url()."/uploads/test.png";
    $config['maintain_ratio'] = TRUE;
    $config['width']         = 800;
    $config['height']       = 600;
    $config['new_image'] = base_url().'/uploads/resized.jpg';


    $this->load->library('image_lib');
    $this->image_lib->initialize($config);
    $this->image_lib->resize();

    echo $this->image_lib->display_errors();
    echo $config['source_image'];

it give me this error :

The path to the image is not correct. Your server does not support the GD function required to process this type of image.

i'm using MAMP as a server and i see GD enabled on phpinfo. i also try to echo the image url , and yes its really there.

please help. Thanks

Upvotes: 1

Views: 3867

Answers (1)

Suvash sarker
Suvash sarker

Reputation: 3170

You have to use relative path and you can try with this one

$this->load->library('image_lib');
// Set your config up
$this->image_lib->initialize($config);
// Do your manipulation
$this->image_lib->clear();

Please see this one

Upvotes: 3

Related Questions