Convert not found when ImageMagick is in the path
StephaneC - October 25, 2009 - 01:14
| Project: | Image |
| Version: | 6.x-1.0-beta3 |
| Component: | imagemagick toolkit |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
ImageMagick cannot be configured when convert is in the PATH whereas you do not know the complete path. This is my case since my ISP did not provide me the full path of convert.
The attached patch solves the issue.
Was tested both when full path is known and when convert is in the PATH.
| Attachment | Size |
|---|---|
| image.patch | 4.59 KB |

#1
Thanks for the patch :)
I don't have a system I can test imagemagick stuff on, so it's going to have to wait for someone who can test this.
Looks reasonable to a quick read, but a couple of points:
- is there a reason for your renaming _image_imagemagick_check_path() to remove the underscore? By convention the initial underscore that means it's a module-internal function. Renaming it in this patch only adds noise as far as I can tell.
- I'd appreciate a comment above this line: if (strcmp(dirname($path), ".") == 0) to say what you are testing. PHP file and string functions hurt my brain :(
#2
Thanks for your prompt comments.
Here are my answers:
- I remove the underscore because i need to call it from the
image_im_advanced_requirements. From my understanding i do not have other solution to make it callable from an external routine. Let me know if i am wrong.- OK, comments added, new patch provided.
#3
I don't see a call to image_imagemagick_check_path() either with or without underscore in image_im_advanced_requirements() or anywhere in the file image_im_advanced.install.
Private functions in PHP are a convention, not a rule of the language. And to be honest, I don't know if 'private' means in the same module, or whether we can say within the image package counts as private. Logically I suppose we should mean just within the module, so your change removing the underscore is correct -- if I could find an external call to it!
#4
It is called through the following code in image_im_advanced.install:
image_toolkit_invoke("check_path", array($convert_path))#5
Ok...
so you're changing what used to be an internal function to something that's sort of hook-like in that an invoke function will treat is as an implementation....
This sounds like a big change to me, but I've no idea what this really means as I've never used imagemagick.
So if a couple of people confirm this is good, I'll commit :)