上传GIF时出错(Paperclip + Heroku)

时间:2016-05-30 01:25:37

标签: ruby-on-rails paperclip

正常图片上传没有任何问题。但是当我上传一个gif时,我遇到了以下错误(在Heroku上):

2016-05-30T01:02:07.921110+00:00 app[web.1]: Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/84366803777e6ba127f4668d0a6fcb9620160530-3-p2zqvm.gif[0]' 2>/dev/null
2016-05-30T01:02:07.884280+00:00 app[web.1]:   User Load (0.8ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1  ORDER BY "users"."id" ASC LIMIT 1  [["id", 1]]
2016-05-30T01:02:07.880104+00:00 app[web.1]: Started POST "/posts" for 98.210.61.51 at 2016-05-30 01:02:07 +0000
2016-05-30T01:02:07.982209+00:00 app[web.1]: Command :: convert '/tmp/84366803777e6ba127f4668d0a6fcb9620160530-3-p2zqvm.gif' -coalesce -auto-orient -resize "x600" -crop "600x600+261+0" +repage -layers "optimize" '/tmp/30814860eb885007ee53253cd97e4f7120160530-3-17fof21'
2016-05-30T01:02:07.917212+00:00 app[web.1]: Command :: file -b --mime '/tmp/84366803777e6ba127f4668d0a6fcb9620160530-3-bh1adr.gif'
2016-05-30T01:02:07.977511+00:00 app[web.1]: Command :: identify -format %m '/tmp/84366803777e6ba127f4668d0a6fcb9620160530-3-p2zqvm.gif[0]'
2016-05-30T01:02:15.540447+00:00 app[web.1]: Completed 500 Internal Server Error in 7633ms (ActiveRecord: 0.8ms)
2016-05-30T01:02:15.351468+00:00 app[web.1]: Killed
2016-05-30T01:02:15.686936+00:00 heroku[router]: at=info method=POST path="/posts" host=www.domain.com request_id=9616fba2-ea79-428d-88d4-8a8eb39e249d fwd="98.210.61.51" dyno=web.1 connect=1ms service=13748ms status=500 bytes=1754
2016-05-30T01:02:15.616705+00:00 app[web.1]: 
2016-05-30T01:02:15.616750+00:00 app[web.1]: Paperclip::Error (There was an error processing the thumbnail for 84366803777e6ba127f4668d0a6fcb9620160530-3-p2zqvm):
2016-05-30T01:02:15.616752+00:00 app[web.1]:   app/controllers/posts_controller.rb:71:in `create'

型号:

accepts_nested_attributes_for :code_snippets, reject_if: :all_blank, allow_destroy: true

has_attached_file   :image, 
                    styles: { 
                        large: '600x600#'
                    }, 
                    default_url: "/images/:style/missing.png",
                    :s3_host_name => "s3-us-west-1.amazonaws.com"

validates_attachment :image, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"] }

这是有问题的图片:

hydra

更新

当我删除裁剪样式时,相同的图像工作正常。裁剪GIF时会出现问题。

0 个答案:

没有答案