I've gone through and tried to clean up the ImageMagick code so that it works the same under windows and unix. The parameters are now escaped properly and errors and output are captured.
I tested this under WindowsXP and FreeBSD. I'd love some other feedback.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | image.imagemagick.inc__2.patch | 3.86 KB | drewish |
| #9 | image.imagemagick.inc__1.patch | 3.85 KB | drewish |
| #3 | image.imagemagick.inc__0.patch | 3.45 KB | drewish |
| image.imagemagick.inc_.patch | 3.53 KB | drewish |
Comments
Comment #1
herb commentedThanks for your efforts in trying to get this to work. I've been hoping for this since http://drupal.org/node/115006
I'm pretty new at this, but I seem to have successfully applied the patch - However, I got an error as follows:
Fatal error: Call to undefined function: stream_get_contents() in C:\wamp\www\testsite.com\includes\image.imagemagick.inc on line 102
Do I need to use a patched version of 5.x-1.x-dev or am I missing something else?
Comment #2
herb commentedI was using php 4.4.4 when I got the function call error. I switched to php 5 and now I got the following:
* ImageMagick reported an error: convert.exe: unable to open image `sites/bravo.com/files/images/temp/lavinia_1680x1050.jpg': No such file or directory. convert.exe: missing an image filename `sites/bravo.com/files/images/temp/lavinia_1680x1050.thumbnail.jpg'.
* ImageMagick reported an error: convert.exe: unable to open image `sites/bravo.com/files/images/temp/lavinia_1680x1050.jpg': No such file or directory. convert.exe: missing an image filename `sites/bravo.com/files/images/temp/lavinia_1680x1050.preview.jpg'.
* Your Image has been created.
* Unable to create thumbnail image
* Unable to create preview image
* The selected file C:\wamp\www\testsite.com\sites\bravo.com\files could not be copied.
* The selected file C:\wamp\www\testsite.com\sites\bravo.com\files could not be copied.
Comment #3
drewish commenteddoh, good catch. i forgot that stream_get_contents() is PHP 5 only. i also had another bug in there that wasn't passing the command in properly. would you mind testing it on PHP4 again?
Comment #4
drewish commentedi also enabled some debug messages to display the command being executed and the output. feel free to comment those out if it looks like it's working.
Comment #5
herb commentedOK - back to php 4.4.4 with 0.patch gives the following:
* ImageMagick command: start "a window title" /b "c:\im\convert.exe" -scale 300x188! -filter QUADRATIC "sites/bravo.com/files/images/temp/ziah_1680x1050.jpg" "sites/bravo.com/files/images/temp/ziah_1680x1050.thumbnail.jpg"
* ImageMagick output:
* ImageMagick reported an error: convert.exe: unable to open image `sites/bravo.com/files/images/temp/ziah_1680x1050.jpg': No such file or directory.
* ImageMagick command: start "a window title" /b "c:\im\convert.exe" -scale 750x469! -filter QUADRATIC "sites/bravo.com/files/images/temp/ziah_1680x1050.jpg" "sites/bravo.com/files/images/temp/ziah_1680x1050.preview.jpg"
* ImageMagick output:
* ImageMagick reported an error: convert.exe: unable to open image `sites/bravo.com/files/images/temp/ziah_1680x1050.jpg': No such file or directory.
* Your Image has been created.
* Unable to create thumbnail image
* Unable to create preview image
* The selected file C:\wamp\www\testsite.com\sites\bravo.com\files could not be copied.
* The selected file C:\wamp\www\testsite.com\sites\bravo.com\files could not be copied.
I'll try to test more later
Comment #6
drewish commentedhumm, you might need to apply the patch i posted to http://drupal.org/node/124474
Comment #7
herb commentedOK - I applied ONLY 124474 patch to image.module. (not any others in that thread)
I ran a separate Gallery installation with GD2 disabled to prove that the ImageMagick6.3.2 installation is working properly.
I'm getting essentially the same error as previously, except it's now trying to create 2 thumbnails? - instead of thumbnail and preview? When the dust settles, there is a copy of the original jpg in the images directory.
With the GD2 toolkit everything works fine. The path to my convert binary is c:\im\convert.exe - if I just use c:\im\ it is accepted in the configuration screen, but then has the same execution failure as before without convert.exe. ImageMagick command: start "a window title" /b "c:\im\" -scale 300x188! -filter QUADRATIC - Using c:\im\convert is rejected as not being an executable.
The full errors with the current setup are as follows:
ImageMagick command: start "a window title" /b "c:\im\convert.exe" -scale 300x188! -filter QUADRATIC "sites/bravo.com/files/images/temp/hermione_1680x1050.jpg" "sites/bravo.com/files/images/temp/hermione_1680x1050.thumbnail.jpg"
ImageMagick output:
ImageMagick reported an error: convert.exe: unable to open image `sites/bravo.com/files/images/temp/hermione_1680x1050.jpg': No such file or directory.
ImageMagick command: start "a window title" /b "c:\im\convert.exe" -scale 300x188! -filter QUADRATIC "sites/bravo.com/files/images/temp/hermione_1680x1050.jpg" "sites/bravo.com/files/images/hermione_1680x1050.thumbnail.jpg"
ImageMagick output:
ImageMagick reported an error: convert.exe: unable to open image `sites/bravo.com/files/images/temp/hermione_1680x1050.jpg': No such file or directory.
Your Image has been created.
Unable to create scalled thumbnail image
Unable to create scalled thumbnail image
The selected file C:\wamp\www\testsite.com\sites\bravo.com\files could not be copied.
The selected file C:\wamp\www\testsite.com\sites\bravo.com\files could not be copied.
Is there anything else I should try? - Also, a question of protocol - is it OK to paste error messages into this post, or should they be attached as a text or screenshot?
Comment #8
herb commentedSorry I don't know enough php to help debugging this code. However, as another data point - I thought that it was actually almost working last month in another test site - so I just tried it again in that site. Using the following:
// $Id: image.imagemagick.inc,v 1.3.2.1 2007/01/19 22:55:32 walkah Exp $ and
// $Id: image.module,v 1.209.2.4 2007/02/19 04:07:44 walkah Exp $
I still got the same unable to create and file could not be copied errors, however... it DID manage to generate and name the correctly sized files in the temp directory and copy the original to the images directory.
Comment #9
drewish commentedthanks for all your testing herb. it turns out that when i'd installed drupal on my test machine i'd specified the file path as
c:\bla\files. after doing a clean install and gettingfilesas my path i got the same error you were encountering. please try out this version of the patch it should solve your problems.oh and i think error messages are fine in the body of messages. i usually throw them between some &tl;code> tags to make them stand out though.
Comment #10
drewish commentedi commented out the debugging messages. i think this is RTBC but i'd like to get a second opinion.
Comment #11
herb commentedYEAH!
It works! - Thanks for your efforts - I've got 600 images in 4 sizes that I would now like to re-convert. - I'll try a test with image_enhanced_scaling module next.
Comment #12
drewish commentedi went a head and committed this since it's a huge improvement over the previous version. hopefully walka won't mind.
i don't think image_enhanced_scaling will work with this. and that module looks like a total and complete hack. it really should just be a new image magick toolkit.
Comment #13
(not verified) commented