0

I am new to web development. I am using codeigniter MVC pattern framework right now. I have a problem on cropping images. I am currently developing an application which needs image cropping process when uploading profile pictures.

After the research on google and codeigniter documentation, I got to know that, there is a tool called imagemagick. I am facing a problem on giving imagemagick path to the codeigniter code. But, I realized that, the codeigniter does not contain the imagemagick tool by default. The codeigniter documentation is not clear. It does not explain where to download imagemagick. I downloaded imagemagick tool from https://github.com/Max-Liu/CodeIgniter-Imagick-Library github page. I linked it in my code. But still, i do not know how to use this tool. Bellow, I have uploaded my code. I get this error "Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct.".

$imgPath = $this->upload->data();

$config['image_library'] = 'imagemagick';
$config['library_path'] = './system/libraries/imagick_lib.php';
$config['source_image'] =  $imgPath['full_path'];
$config['x_axis'] = 100;
$config['y_axis'] = 60;


$this->image_lib->initialize($config);

if ( ! $this->image_lib->crop())
{

     echo $this->image_lib->display_errors();

}
  • what version of CI are you using? – Vickel Mar 29 '19 at 17:44
  • I am using CodeIgniter 3.x (3.1.9) – Guna Rakulan Mar 29 '19 at 17:47
  • I think what you want is described here: [`https://www.codeigniter.com/userguide3/libraries/image_lib.html`](https://www.codeigniter.com/userguide3/libraries/image_lib.html). The CodeIgniter-Imagick-Library is over 6 years old (and therefore might not work with CI 3.x). It also seems to be made only for "easy to create simple image" – Vickel Mar 29 '19 at 17:51
  • I do not know code igniter, but imagemagick crop require 4 arguments: Width, Height, Xoffset, Yoffset. – fmw42 Mar 29 '19 at 18:07
  • Do we need to install imagemagick on windows? or does it come pre-install. I am using xampp server – Guna Rakulan Mar 29 '19 at 18:10

0 Answers0