[英]Rails: PaperClip alongside Sidekiq and postprocessing of image
I am using the Paperclip
gem to allow my users to upload an avatar (which is uploaded/hosted on S3
) but am having issues when it comes to server performance. 我正在使用
Paperclip
gem来允许我的用户上传一个头像(在S3
上传/托管),但在服务器性能方面遇到了问题。 It seems to take forever to upload the photo and I am thinking it's because it runs through all of the conversion metrics before redirecting the user back to their profile on a successful upload. 上传照片似乎需要永远,我认为这是因为它会在成功上传之前将用户重定向回其个人资料之前贯穿所有转换指标。
Here is my PaperClip settings: 这是我的PaperClip设置:
has_attached_file :avatar, PAPERCLIP_OPTIONS.merge(
:default_url => "//s3.amazonaws.com/bucket-name/media/avatar-placeholder.gif",
:styles => {
:"58x58" => "35x35^",
:"150x150" => "56x56^",
:"184x185" => "165x110^",
:"259x259" => "259x259^"
},
:convert_options => {
:"58x58" => "-background transparent -auto-orient -gravity center -extent 58x58",
:"150x150" => "-background transparent -auto-orient -gravity center -extent 150x150",
:"184x185" => "-background transparent -auto-orient -gravity center -extent 184x185",
:"259x259" => "-background transparent -auto-orient -gravity center -extent 259x259"
}
)
Is there anyway to utilize Sidekiq
to offload the convert options? 反正有没有利用
Sidekiq
卸载转换选项?
I think there is a gem that you can use. 我认为你可以使用一颗宝石。 https://github.com/jrgifford/delayed_paperclip/
https://github.com/jrgifford/delayed_paperclip/
As described, you can config paperclip with DJ, Resque and Sidekiq, hope it helps. 如上所述,您可以使用DJ,Resque和Sidekiq配置回形针,希望它有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.