Forum: Ruby on Rails RMagic via Rails: "Corrupt JPEG data"

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Doug (Guest)
on 2006-04-10 19:55
I'm having some trouble with opening files with ImageMagick, by way of
RMagick, from within Rails. When trying to open an existing image, I get
this error:
"Corrupt JPEG data: premature end of data segment: "

My code is pretty straightforward:
pic =

I can view the image in question through the browser, so I don't think
it's corrupt. I can run a stand alone Ruby script from the command line,
and that does work, so I'm guessing the library is installed correctly.
However, if I try to trigger this external script from within Rails with
backticks (like `ruby resize.rb`), it craps out by the "require
'RMagick'" line.

I needed the functionality yesterday, so I have Rails triggering a perl
script, but that's a pretty shitty way of dealing with it. I'd love to
get it right. Any ideas?

This topic is locked and can not be replied to.