ここを参考にしました。
Fleximageというプラグインです。
http://www.clear-code.com/blog/2009/3/23.html
まず、aws-s3を入れる。
sudo gem install aws-s3
RMagickのインストールはここを参考に。
http://superuser.com/questions/152079/how-to-install-rmagick-rubygem-on-mac-os-x-10-6-snow-leopard
cd ~/src git clone git://github.com/masterkain/ImageMagick-sl.git cd ImageMagick-sl sh install_im.sh sudo gem install rmagick
できましぇん。
brewでいけるのかな。
http://superuser.com/questions/152079/how-to-install-rmagick-rubygem-on-mac-os-x-10-6-snow-leopard
brew install imagemagick sudo gem install rmagick
でいけた。
ここからが本題。
fleximageの使用宣言
モデルに以下を追加。
class Photo < ActiveRecord::Base acts_as_fleximage :image_directory => 'public/images/uploaded' end
scaffoldのフォームの変更箇所は以下。
<% form_for(@photo, :html => {:multipart => true}) do |f| %> <p> <%= f.label :image_file %><br /> <%= f.file_field :image_file %> </p>
controllerにdef thumbnailを追加してthumbnailアクションを作っておく。
で、こいつにアクセスできるようにconfig/routes.rbを編集する。
thumbnail_photo_pathは、適宜thumbnail_
http://www.ruby-forum.com/topic/159519