1. Download RMagick For Win
2. Unzip the file to local folder.
#gem install rmagick --local
3. Install file-column as plugin
#ruby script/plugin install http://opensvn.csie.org/rails_file_column/plugins/file_column/trunk
Code 1:
class Entry < ActiveRecord::Base 'image'是entry这个表的一个字段,储存文件的路径。 上载 : 显示: _form.html: show.html: |
"thumb" => "50x50" : 表示默认宽度50,高度自适应
"thumb" => "50x50!" : "!"表示强制50*50
"thumb" => "50x50>" : ">"表示如果图片本来就小,就不用放大
file_column :image, :store_dir=>"你想要存图片的目录"