1

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

taek
  • 1,009
  • 3
  • 11
  • 14

1 Answers1

3

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

Suvash sarker
  • 3,140
  • 1
  • 18
  • 21
  • Hello!, Thanks for the answer. you see i already use initialization. so i try using a relative url, something like this (../uploads/test.png) right ? i also add "$this->image_lib->clear();" after "$this->image_lib->resize();" while now it doesn't give me an error but the image is not resized yet. – taek Sep 24 '15 at 16:59
  • 1
    hey, i just change the source url to "./uploads/test.png" and it works, Thanks anyway ! :) – taek Sep 24 '15 at 17:04