CodeIgniter Forums
Anyone managed to install ImageMagick with Linux, PHP Version 5.5.9-1ubuntu4.7 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Anyone managed to install ImageMagick with Linux, PHP Version 5.5.9-1ubuntu4.7 (/showthread.php?tid=61444)



Anyone managed to install ImageMagick with Linux, PHP Version 5.5.9-1ubuntu4.7 - John_Betong - 04-16-2015

The following works fine:
PHP Code:
 $thumbnail = new Imagick($pix);
 
 $wid 128;
 
 $thumbnail->thumbnailImage$wid);
 
 $thumbnail->enhanceImage();

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




Problem - cannot use CodeIgniter  Image Library: 
The $config['library_path'] is incorrect.



Tried the following without success:
PHP Code:
// 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/'              // 20-imagick.ini
 
 '/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['image_library']     = 'imagick';
$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



RE: Anyone managed to install ImageMagick with Linux, PHP Version 5.5.9-1ubuntu4.7 - John_Betong - 04-18-2015

Cracked it although it maybe a KLUDGE?

what through me was the incorrect error message stating the image_library path was incorrect which I knew was OK so I investigated CodeIgniter 3.0-0 source files:

File: ./CodeIgniinter 3.0-0/system/libraries/image_lib.php
PHP Code:
# Line: 887
$retval 1;
// exec() might be disabled
if (function_usable('exec'))
{
# MISSING function value
# @exec($cmd, $output, $retval);


# PLEASE READ POST: #4 - THIS MODIFICATION IS UNNECESSARY
# ADDED function value 
$retval = @exec($cmd$output$retval);


I was wondering,am I the only one using the ImageMagick library because without this modification the incorrect error message is returned?

Demo:
http://www.johns-jokes.com/welcome?toggle


RE: Anyone managed to install ImageMagick with Linux, PHP Version 5.5.9-1ubuntu4.7 - gadelat - 04-18-2015

Without corrupted language file it's impossible that line was causing given error about incorrect path, because that message is returned on a line far above the one you modified. Also, it's failing because imagemagick returns error status code. You should properly debug this by seeing output of $output var.


RE: Anyone managed to install ImageMagick with Linux, PHP Version 5.5.9-1ubuntu4.7 - John_Betong - 04-19-2015

(04-18-2015, 09:35 AM)gadelat Wrote: Without corrupted language file it's impossible that line was causing given error about incorrect path, because that message is returned on a line far above the one you modified. Also, it's failing because imagemagick returns error status code. You should properly debug this by seeing output of $output var.

I had spent a long time trying to get ImageMagick to work. I think it was coincidental that the modifications I made managed to get the library to work. I have since removed the modification and the image library is now working fine.

Mod: Please feel free to delete this thread.