新手问题 rmagick 问题

suyuhang · May 09, 2014 · Last by MrPasserby replied at May 09, 2014 · 2067 hits

class PhotoUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick

version :thumb do process :resize_to_limit => [200,200] end

# process :store_geometry # def store_geometry # img = ::Magick::Image::read(@file.file).first # if model # model.weight = img.columns # model.height = img.rows # end end

开始我是用注销的这个方法写的 但是不能修改图片的尺寸。

后来我用 thumb 定义版本这么写 可是却一直报错

错误如下:wrong number of arguments (1 for 0)

我在 show 页面也写了 <%= image_tag @teacher.picture(:thumb) %>

我想请问各位 怎么修改一下 就可以自定义尺寸了

<%= image_tag @teacher.image_url(:thumb) %>

试试这个

<%= image_tag @teacher.picture.url(:thumb) %>

也可以试试

You need to Sign in before reply, if you don't have an account, please Sign up first.