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. 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:
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?
I think there is a gem that you can use. https://github.com/jrgifford/delayed_paperclip/
As described, you can config paperclip with DJ, Resque and Sidekiq, hope it helps.