ImageMagick的Codeigniter库不起作用

时间:2018-07-16 02:22:29

标签: imagemagick codeigniter-3

带有codeigniter的Imagemagick库不起作用, 相同的图像处理操作可以完美地与GD2库一起使用,但是Imagemagic库不会显示任何输出或任何错误。有什么问题,我该如何解决?预先感谢

用于调整图片大小的代码:

$data['title'] ='Resize Image';
$upload['upload_path'] = './assets/images/';
$upload['allowed_types'] = 'gif|jpg|jpeg|png';
$this->load->library('upload',$upload);
$filedata1 = $this->upload->data();
if(!$this->upload->do_upload('userfile')){
    show_error($this->upload->display_errors());
}           
$this->load->library('image_lib');
//$config['image_library'] = 'gd2';
$config['image_library'] = 'imagemagick';
$config['library_path'] = '/usr/X11R6/bin/';
$config['source_image'] = $this->upload->data('full_path');
$config['width']         ='100';
$config['height']       = 250;
$this->image_lib->initialize($config);
if(!$this->image_lib->resize()){
    show_error($this->image_lib->display_errors());
}
$filedata = $this->upload->data();
$data['img2'] = base_url().'/assets/images/'.$filedata['file_name'];
print $this->load->view('pages/result',$data,true);

1 个答案:

答案 0 :(得分:0)

通过在PHP安装程序中加载imagemagick扩展并将imagick替换为“ ImageMagick”,可以解决此问题。