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.

AttachmentSize
image.patch4.59 KB

#1

joachim - October 25, 2009 - 09:17
Status:needs review» needs work

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

StephaneC - October 25, 2009 - 23:40
Status:needs work» needs review

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.

AttachmentSize
image.2.patch 4.84 KB

#3

joachim - October 26, 2009 - 10:04

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

StephaneC - October 26, 2009 - 21:16

It is called through the following code in image_im_advanced.install:
image_toolkit_invoke("check_path", array($convert_path))

#5

joachim - October 26, 2009 - 23:52

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 :)

 
 

Drupal is a registered trademark of Dries Buytaert.