Reputation: 4869
I understand that ImageMagick can be used with codeigniter. But where should I put the dll for imageMagick in the codeigniter folder? I am currently using codeiginiter on mac. I searched and got some answers in which imageMagick is installed in the bin folder. If I put the website live can I still use the ImageMagick?
My intention is to use ImageMagick to fetch some images and do overlaying to generate one image and save it. However when I try loading with the below code I got an error
$config['image_library'] = 'ImageMagick';
echo site_url();
$config['source_image'] = site_url().'marcella-resources/front/img/M24CPP_x200/SBase1.jpg';
$config['new_image'] = site_url().'marcella-resources/front/test/SBase1_copy.jpg';
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->load->library('image_lib', $config);
if ( !$this->image_lib->resize())
{
echo $this->image_lib->display_errors();
$this->image_lib->clear();
}
The error is
The path to the image is not correct.
The path to your image library is not correct. Please set the correct path in your image preferences.
Upvotes: 0
Views: 5453
Reputation: 1868
When you upload your source image put Server root path and then full path to your folder. You can not use site url.
Put upload path as :
$upload_path = $_SERVER["DOCUMENT_ROOT"]."marcella-resources/front/img/M24CPP_x200/";
Then try this lines :
$config['source_image'] = $_SERVER["DOCUMENT_ROOT"].'marcella-resources/front/img/M24CPP_x200/SBase1.jpg';
$config['new_image'] = $_SERVER["DOCUMENT_ROOT"].'marcella-resources/front/test/SBase1_copy.jpg';
that will work absolutely. :)
Upvotes: 0
Reputation: 11
Replace these lines:
$config['source_image'] = site_url().'marcella-resources/front/img/M24CPP_x200/SBase1.jpg';
$config['new_image'] = site_url().'marcella-resources/front/test/SBase1_copy.jpg';
with these lines:
$config['source_image'] = 'marcella-resources/front/img/M24CPP_x200/SBase1.jpg';
$config['new_image'] = 'marcella-resources/front/test/SBase1_copy.jpg';
Upvotes: 1