Using rmagick to find the colors of an image..
img = Magick::Image.read("#{Rails.root}/public#{@design.photo.url(:profile)}").first
Here is the error
unable to open image `/tmt/public/system/designs/photos/000/000/005/profile/5.jpg?1380037883': No such file or directory @ error/blob.c/OpenBlob/2646
The file is pointing to the exact location of the image, maybe the extension (?1380037883) is throwing it off but i can't seem to solve the problem. Do y'all know what's going on? Maybe you've seen a similar problem using rgmagick...heres my gemfile
gem 'rmagick', :require => 'RMagick'
If i point to an image in my app/assets/images directory it works perfectly...it's just when im using variables to find the image a user uploads that is has this error...
for instance this works perfectly
img = Magick::Image.read("#{Rails.root}/app/assets/images/ruby.png").first
You should use the .path
method instead of .url
:
.url
returns the relative path of the file.path
returns the absolute path of the fileIn your case:
img = Magick::Image.read( @design.photo.path ).first