我使用回形针 + 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 Bucket 中存储了 4 个不同大小的图像的 4 个副本)
当我使用 JCrop 裁剪图像时出现问题,S3 存储 4 个副本,但裁剪图像的大小相同,实际上是大尺寸。
我的控制器.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