1

I want to use imageMagick for image processing. Now I have installed ImageMagick ImageMagick-6.8.4-10-Q16-x64-dll.exe but still I face the following error:

Image processing failed. Please verify that your server supports the chosen protocol and that the path to your image library is correct.

My code is -

$config = array();
$config['image_library'] = 'ImageMagick';
$config['source_image'] = $file;
$config['new_image'] =  $file;
$config['library_path'] = '/usr/local/bin';
$config['create_thumb']    = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width']     = 50;
$config['height']   = 50;
$this->image_lib->initialize($config); 
 if ( !$this->image_lib->resize())
        {
            echo "resize -".$this->image_lib->display_errors();
        } 
        $this->image_lib->clear();
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Swati Patil
  • 41
  • 1
  • 3
  • Before posting this type of question it would be helpful if you give information about your development environment. – Mahesh.D Apr 23 '13 at 06:32
  • for [windows 7](http://stackoverflow.com/questions/3036847/how-to-install-imagemagick-on-windows-7), [xp](http://www.mobilefish.com/developer/imagemagick/imagemagick.html), [Ubuntu](http://superuser.com/questions/163818/how-to-install-rmagick-on-ubuntu-10-04). After instillation it would better to restart the `web server`. – Mahesh.D Apr 23 '13 at 06:35

2 Answers2

0

Wait. I assumed you are using Windows (as you installed .exe ), but your path is a Linux path (/usr/local/bin). Double check your installation path.

Raptor
  • 53,206
  • 45
  • 230
  • 366
0

Below has given me expected result. Hope you will also get same.

    $this->load->library('image_lib');

    //For resizing of image in size of dilog
    $config['image_library']  = 'ImageMagick';
    $config['library_path'] = 'C:\\ImageMagick\\';

    $config['source_image'] = $source_filepath;
    $config['new_image'] = $new_filepath;

    $config['width'] = 128;
    $config['height'] = 128;
    $config['quality'] = '100%';
    $config['maintain_ratio'] = TRUE;

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

    if (! $this->image_lib->resize()) {
        $error_msg = $this->image_lib->display_errors();
        print_r($error_msg);
    }
    else {
        echo "Done";
    }

Here

$config['library_path'] = 'C:\\ImageMagick\\'; 

is the path for windows where your imageMagick application is installed.(Try to install in such a folder to which we can easily fingd the path upto it). Change the image library to :

$config['image_library']  = 'ImageMagick';

& other all configuration is remains same.

Raj
  • 706
  • 8
  • 18