Swati Patil
Swati Patil

Reputation: 41

how can i provide image library path for imagemagick

I am using ImageMagick library in CodeIgniter for re-sizing and rotating image using image library. But its generating error. The error is -"The path to your image library is not correct. Please set the correct path in your image preferences."

$config = array();
$config['image_library']  = 'ImageMagick';
$config['source_image']   = $file;
$config['new_image']      =  $file;
$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();

Upvotes: 3

Views: 4095

Answers (3)

Divakarcool
Divakarcool

Reputation: 481

$config['library_path'] = '/usr/bin';

add this line in your config.

Upvotes: 0

Raj
Raj

Reputation: 716

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 map it for library path). Change the image library to :

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

& other all configuration is remains same.

Upvotes: 1

chandresh_cool
chandresh_cool

Reputation: 11830

I think you are not giving correct path basically imagemagick is installed somewhere ideally in /user/bin. When I worked I use to give like this

imageMagickConvert = /usr/bin/convert 
imageMagickComposite = /usr/bin/composite 

Upvotes: 0

Related Questions