Has anyone managed to use ImageMagick with CodeIgniter's "image_lib" library using LinuxMint's PHP Version 5.5.9-1ubuntu4.7?

Without CodeIgniter Image Library:

<?php
 $thumbnail = new Imagick($pix);
  $wid = 128;
  $thumbnail->thumbnailImage( $wid, 0 );
  $thumbnail->enhanceImage();

  $thumbnail->sharpenimage(1,1,Imagick::CHANNEL_ALL); //$radius, $sigma, $channel);
  $ok = $thumbnail->writeImage( 'thumbs/'.$thb ); 

  //works fine, no problem


With CodeIgniter Image Library

<?php 
// PHP Version 5.5.9-1ubuntu4.7
$paths = array 
(
  '/opt/local/bin',
  '/opt/local/bin/',
  '/usr/bin/mogrify',
  '/usr/bin/mogrify/',
  '/usr/bin/convert',
  '/etc/php5/apache2/conf.d/',   
  '/etc/php5/apache2/conf.d/20-imagick.ini', // extension=imagick.so
  '/etc/ImageMagick',
  '/etc/ImageMagick/',
  '/usr/include/php5/ext/imagick',
  '/var/lib/dpkg/info/php5-imagick.prerm',
);
$path = $paths[0..10]); // tried all 10 options :-(
echo '$path --> ' .$path .'<br />';

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

$config['image_library'] = 'ImageMagick'; 
$config['library_path']    = $path;
...
...
if ( ! $this->image_lib->resize())
{
   echo '<h1 style="color:red">' .$this->image_lib->display_errors() .'</h1>';
  /*
    **Output**
      Image processing failed. 
      Please verify that your server supports the chosen protocol 
       and that the path to your image library is correct. 
*/
}

Do you have SSH access into the box, what do you get when you run
whereis convert

Running on Localhost, have yet to try online.

john@john:~ > whereis convert
convert:

john@john:~ > whereis ImageMagick
ImageMagick: /etc/ImageMagick /usr/include/ImageMagick
john@john:~ > 

**Update:**
Installed from LinuxMint's Software Manager:
  
php5-imagick
Imagemagick module for php5
This package provides a wrapper for ImageMagick library directly from PHP scripts.

PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.

Details:
Version: -3.1.2-1build1
Size: 558k of disk space freed

hmm… I think you’d have to have convert to be able to use the library right? At least from what I recall of imagemagick, convert was the process that actually did the processing. So if it can’t find it, there is something amiss.

I’m getting LinuxMint running on a VM right now so I can see if I can recreate this. It may be as simple as uninstalling and reinstalling ImageMagick

Okay, so I’m 90% sure that the issue is you need to have imagemagick installed too.
apt-get install imagemagick

php5-imagemagick is an extension for PHP to make API calls to imagemagick, it doesn’t replace imagemagick, but complements it (at least that is how I understand it).

So once you run apt-get install imagemagick, then you can run whereis convert and use that as your path.

Edit:
When I ran apt-get install php5-imagemagick, it didn’t include imagemagick as a dependency (you’d think it would…), so I had to manually install that as well.

I notice mogrify and the other programs have two options and the second with a / at the end - try doing the same for convert?

Are you uploading the files via a form or FTP. If FTP are you using the correct format?

I have heard a rumour that IM version 7 may be built into php like GD

@cpradio on Johns first post he said that Imagick on its own works OK and only fails in codeIgnitor so I assume he has both Imagick and Imagemagick installed.

I get that, but if you are trying to tell it where convert is, and convert isn’t available… of course it won’t work! :smile:

Update, I now have ImageMagick installed, rebooted and tried without success.

whereis convert
convert: /usr/bin/convert.im6 /usr/bin/convert /usr/bin/X11/convert.im6 /usr/bin/X11/convert /usr/share/man/man1/convert.1.gz 

@Rubble,

I notice mogrify and the other programs have two options and the second with a / at the end - try doing the same for convert?

Are you uploading the files via a form or FTP. If FTP are you using the correct format?

I have heard a rumour that IM version 7 may be built into php like GD

the mogrify was an option that someone suggested on another forum.

The $paths array(…) contains different $paths that I have tried without success.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.