Welcome Guest, Not a member yet? Register   Sign In
ImageMagick - cannto resize - path to image library problem?
#1

[eluser]Alistair Jackman[/eluser]
Hi.

I'm attempting to use ImageMagick to perform a resize as follows:

Code:
$config['image_library'] = 'ImageMagick';
$config['library_path'] = '/usr/bin';
$config['source_image'] = 'assets/P1000318.JPG';
$config['new_image'] = 'assets/P1000318_med.JPG';
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 800;
$config['height'] = 600;
        
$this->load->library('image_lib');
$this->image_lib->initialize($config);    
$this->image_lib->resize();

The same resize works fine if I choose GD, but I need to use ImageMagick in order to cope with very large images.

Echoing from image_lib.php I can see the command being attempted is:

Quote:/usr/local/bin/convert -quality 90 -resize 800x451 "/home/verydesi/public_html/2009/admin/assets/P1000318.JPG" "assets/P1000318_med.JPG" 2>&1

But I just get the error:

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

I have checked with my hosting that ImageMagick is installed, this is their response:

Quote:Imagemagick is installed in the server hosting your domain.

===================================================
Version: ImageMagick 6.4.8 2009-04-02 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright © 1999-2009 ImageMagick Studio LLC
====================================================

The path would be /usr/bin/mogrify .

I've also done the following to see if 'convert' is where I expect it to be and I can see 'convert' no problem:

Code:
$map = directory_map('/usr/bin');
print_r($map);

Can you suggest a possible solution? I'm baffled!

Regards
AJ
#2

[eluser]TheFuzzy0ne[/eluser]
Have you tried setting the path to: /usr/bin/mogrify

Also, I'd recommend your specify the library name in lowercase, too. I shouldn't have thought it would matter, however.
#3

[eluser]Alistair Jackman[/eluser]
Yes I've tried that path. When the hosting admin said that was the path I assumed that is the path to the individual executable 'mogrify'. I see that 'mogrify' resizes, crops etc but overwrites the original file, whereas 'convert' is used when a copy is desired.

From what I can see in /usr/bin both these executables are present, which is why it seems so weird it doesnt work!
#4

[eluser]TheFuzzy0ne[/eluser]
Apparently, mogrify doesn't overwrite the original image is the -format switch is specified.

Have you confirmed that you can actually run mogrify from the command line?
#5

[eluser]Alistair Jackman[/eluser]
Thanks for your replies.

I haven't run any of the ImageMagick commands from the command line no. Wasn't sure how to test that way without requesting the hositng company do the test for me. Perhaps I'm assuming too much, but it's part of their standard hosting package so I was trusting it to be in the right place, installed corerctly etc.

CodeIgniter wants to run 'convert' when ImageMagick is chosen, so I'm not sure the mogrify route is going to help me?
#6

[eluser]TheFuzzy0ne[/eluser]
convert is a part of ImageMagick.
#7

[eluser]Alistair Jackman[/eluser]
Yes I understand that. Mogrify and Convert are two of the ImageMagick utilities. Both appear to be installed in /usr/bin on my server. I think in the original response from the hosting provider they were just assuming I was trying to run Mogrify.

Given that Convert is available in /usr/bin/ the issue is why the following command fails:

/usr/local/bin/convert -quality 90 -resize 800x451 “/home/verydesi/public_html/2009/admin/assets/P1000318.JPG” “assets/P1000318_med.JPG” 2>&1

This is the command that CodeIgniter builds up on line 593 of Image_Lib.php.

Apologies if I've made this confusing.
#8

[eluser]TheFuzzy0ne[/eluser]
It's looking in /usr/local/bin/ and not /usr/bin/ where is should be.

EDIT: I'd also try leaving the path blank, also. You should find it still works just as well as it does now, but hopefully better.
#9

[eluser]Alistair Jackman[/eluser]
Sorry, I pasted the the wrong test result..

Rest assured I have set the library_path to '/usr/bin' and the result is the same:

/usr/bin/convert -quality 90 -resize 800x451 "/home/verydesi/public_html/2009/admin/assets/event_39/exhibition_71/press/P1000318.JPG" "assets/event_39/exhibition_71/press/P1000318_med.JPG" 2>&1

So it is at least trying the correct location.
#10

[eluser]TheFuzzy0ne[/eluser]
Indeed. However, I think it might really help if you could run that on the command line yourself, and see the results.




Theme © iAndrew 2016 - Forum software by © MyBB