问题
I receive the following error when I try to get image during thumbnail creation:
undefined method `file' for nil:NilClass
My code:
version :thumb do
img = ::Magick::Image::read(@file.file).first
w = img.columns
h = img.rows
if w < h
process :resize_to_limit => [30, 50]
else
process :resize_to_limit => [50, 30]
end
end
Any ideas what is this not working?
来源:https://stackoverflow.com/questions/24363366/reading-uploaded-image-undefined-method-file-for-nilnilclass