我試圖從瀏覽器上傳文件,然後從中創建一個縮略圖,然後上傳到s3。RMagick - S3 - Heroku,RMagick文件出現問題打開
File.open(params[:file][:tempfile]) do |p|
AWS::S3::Base.establish_connection!(
:access_key_id => settings.s3_key,
:secret_access_key => settings.s3_secret)
AWS::S3::S3Object.store(pic_name,p,settings.bucket,:access => :public_read)
thumb = Magick::Image.read(p)
thumb.crop_resized!(75, 75, Magick::NorthGravity)
AWS::S3::Base.establish_connection!(
:access_key_id => settings.s3_key,
:secret_access_key => settings.s3_secret)
AWS::S3::S3Object.store(pic_name + "s",thumb,settings.bucket,:access => :public_read)
我已經試過最可能的代碼組合,使其工作,但它給了我一個分割錯誤
c:0060 p:---- s:0261 b:0261 l:000260 d:000260 CFUNC :read
c:0059 p:0117 s:0257 b:0257 l:002638 d:000256 BLOCK /Users/gkay/Documents/yirmiyedi/web/banne/app/controllers/firsat.rb:33
c:0058 p:---- s:0253 b:0253 l:000252 d:000252 FINISH
c:0057 p:---- s:0251 b:0251 l:000250 d:000250 CFUNC :open
c:0056 p:0190 s:0247 b:0247 l:002638 d:000246 LAMBDA /Users/gkay/Documents/yirmiyedi/web/banne/app/controllers/firsat.rb:27
時RMagic試圖打開該文件,以便啓動。我已經嘗試了很多東西,如
thumb = Magick::Image.read(p).first or [0] etc but none of them worked.
任何想法? PARAMS [:文件]是後PARAM這使文件
它是否適用於heroku? – gkaykck 2012-02-28 09:45:38
是的,它的確如此。我們在部署在Heroku上的幾個項目中使用它。 – 2012-02-28 10:46:23