ImageMagick and Omeka: Error Determining Version of IM (?)

I was having the same problem I've seen reposted multiple times here in using ImageMagick and Omeka of "ImageMagick is not properly configured. Please check your settings and then try again."

After trying most everything I could find, I finally came across the checkForImageMagick function in File.php (application/models/File.php). I added the following lines *after* the exec function call but before the return (note that I would have just used the logging or debugging options in config.ini...except I couldn't seem to get them to display anything useful!):

print( "\n" );
print( "path: $path\n" );
print( "convert_return: $convert_return\n" );
print( "convert_version:\n" );

foreach( $convert_version as $key ) {
  print( "  $key: $convert_version[$key]\n" );
}

Then, after uploading an image file (site/omeka/admin->Items->Add an Item->Files->Browse->Add Item), I can view the source (Firefox: Ctrl+U, or View->Page Source), scroll to the end and see the print out of my little addition. Most of the information in the convert_version array is just IM usage, but I get:

path: /usr/bin/convert
convert_return: 1
convert_version:
Version: ImageMagick 6.4.9-2 2009-03-03 Q16 OpenMP http://www.imagemagick.org:
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC:

It's easy enough for me to toss in a return True and get Omeka working for now, but can anyone tell me what's going on and a better way to fix this? Does Omeka not support the latest version(s) of ImageMagick?

We're using Gentoo Linux and ImageMagick was specifically emerged for Omeka (somewhat recently, you might notice...). Omeka is also the latest version 0.10.

Edit:

Ehh, re-reading the post, I forgot to note that /usr/bin/convert is the correct path for my system, and the command line convert works like a charm.

Yeah, this is an annoying problem with ImageMagick. The ImageMagick docs say that a return code of 0 indicates success, and anything else indicates failure. Here's a link for that:

http://www.imagemagick.org/script/command-line-tools.php

Yours is returning 1 for some reason, so there appears to be some sort of failure with that. On the other hand, it works fine on the command line.

It may be that newer versions consider a call to the binary with no additional arguments as a failure, so you could try adding a -version argument to what is called, and let me know if that works. Thanks.

I modified to 'convert -version' and am getting exactly the output in php I get from command line. Still, IM returns a value of 1. It seems to me that IM should return 'success' when queried for the version information (I guess unless it can't get that info or something; maybe it returns failure because it couldn't print the info to stdout?). Perhaps Omeka could do a regex check on the version info to see if IM is valid?

I posted on the IM forums (http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=13375) asking them if they think it's their problem or Omeka's, will keep this thread up to date if I hear from them.

Thanks for the response, I had just about given up.