niciliketo
niciliketo

Reputation: 93

RMagick loses the first 8 characters of the file path I am trying to open

I am using Carrierwave with RMagick in my Ruby on Rails application. Everything works fine in development, but on my staging environment, I am having some problems.

I tracked it down to what seems to be a problem with RMagick, losing part of the file path being passed to it. Here is some output from my rails console

require 'RMagick'
=> true
# Prove the file exists
File.open('/tmp/logo.png')
=> #<File:/tmp/logo.png> 
# Cant find it with RMagick
Magick::Image::read('/tmp/logo.png').first
=> Magick::ImageMagickError: unable to open file `o.png' @ error/png.c/ReadPNGImage/3698
# Unless I add some characters at the start of my filepath (anything will do)
Magick::Image::read('12345678/tmp/logo.png').first
=>  0x200=>200x100 4634766966517661696x200+100+0 DirectClass 8-bit 6kb 

I have tried digging into the source code for RMagick, but without much success. I am hoping that someone can suggest what maybe going wrong.

I have tried recompiling ImageMagick and re-deployed the code several times.
We use rvm, Ruby 1.9.2, Rails 3.2.11 and deploy using Capistrano.

Upvotes: 1

Views: 238

Answers (1)

niciliketo
niciliketo

Reputation: 93

My colleague found the solution -

It was to re-install the rmagick gem.

Upvotes: 1

Related Questions