前提:
homebrew
安装的 imagemagick
@wallpaper.picture.url
可以获取到图片url
,并可访问原始图上传类源码:
class WallpaperUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
def store_dir
"#{model.class.to_s.underscore}/#{model.id}"
end
version :thumb do
process :resize_to_fill => [610, 400]
end
end
问题:
Wallpaper.first.picture.versions
,返回 {}
Wallpaper.first.picture.url :thumb
,返回 ArgumentError: Version thumb doesn't exist!
呼叫大神:@huacnlee