I'm planning to upgrade Rails to 5.2 in one of my websites and introduce ActiveStorage, as of right now I use Paperclip with paperclip_optimizer. One of the negative sides is that I will lose the optimizer, when replacing paperclip with ActiveStorage. How can I implement automatically image optimization on user uploads in ActiveStorage?
9
votes
What do you mean by image optimisation? Because activestorage supports all transformations that minimagick does, so you can easily resize, crop, remove metadata, change sampling, reduce quality, etc. It does not run on uploads, but you can either trigger it with a job or let the images be lazily generated when they are needed
– Breno Gazzola
3 Answers
2
votes
It's possible by creating a custom Variation. There is a good example here:
https://prograils.com/posts/rails-5-2-active-storage-new-approach-to-file-uploads
1
votes