ペーパークリップ+S3を使用して画像を保存します
has_attached_file :image,
:whiny => false,
:styles => { :large => "550x340>",
:medium => "165x165>",
:small => "100x100>",
:thumbnail => "55x55>"},
:processors => [:cropper],
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "/:id/:style",
:bucket => "XXX"
画像を使用してオブジェクトを作成すると、すべてがうまくいきます(S3バケットに保存されている4つの異なるサイズの画像の4つのコピー)
問題は、JCropを使用して画像をトリミングするときに発生します。S3は4つのコピーを保存しますが、トリミングされた画像と同じサイズで、実際には大きいサイズです。
私のcontroller.rb:
def update
@deal = Deal.find(params[:id])
respond_to do |format|
if @deal.update_attributes(params[:deal])
format.html { redirect_to(@deal, :notice => 'Deal was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @deal.errors, :status => :unprocessable_entity }
end
end