Q:

RMagick/ImageMagick error "no decode delegate for this image format" with Ruby Tempfile

I'm having a problem using RMagick/ImageMagick to open a file uploaded through a Rails form. I believe this is due to the fact that Rails Tempfile behavior is to eliminate the file extension. From what I've read, ImageMagick should prefer to use magic number rather than file extension to detect the image file format, but that doesn't seem to be the case in my installation. I'm doing this:
img = Magick::Image.read(full_size_image.path)

where full_size_image is the Tempfile object returned from the upload form controller, which creates an error like: 

no decode delegate for this image format `/var/folders/uI/uIsldaxoHkiXKWYFuTWs4++++TI/-Tmp-/RackMultipart20101031-10144-1hiwlw-0' @ error/constitute.c/ReadImage/532

This is happening on Mac OS X 10.6 with Rails 2.3.8, RMagick 2.13.1 and ImageMagick 6.6.5-5. I've confirmed that ImageMagick can convert the file I've been using to test through the upload form successfully, and that the tempfile path/file actually exists/is readable.
I suspect that either a) something in my ImageMagick installation is somehow preventing it from using magic number to detect the file type (?? - getting ImageMagick working on Snow Leopard from source was an adventure itself) or b) there are just cases where this doesn't work and I somehow need to make Tempfile preserve the original file extension.
I know that I can get the original file name from the Tempfile object, but I haven't found a way to rename the file. I suppose I could make some kludge where I use a File object and somehow create a copy of the Tempfile with the original extension on it, but that just seems unseemly. What's the right way to solve this problem?
Thanks for your help.

A:

I figured out the problem - the DYLD_LIBRARY_PATH environment variable was set correctly in my shell where I was testing the command line version of convert but was not set correctly where my Mongrel server was running. After I fixed this, it started working. 

