What does everybody do for optimizing your store's...
# general
g
What does everybody do for optimizing your store's images? We've got some nginx wizardry to return
.webp
versions of a file if it exists, but it doesn't seem to work super consistently. Got me wondering if there was something else that y'all are doing that might be better than just trying to reinvent the wheel. Thanks!
k
are you using paperclip or activestorage?
by the way, with both, you could optimize images or/and convert them to webp quite easily
g
I believe it's activestorage, double checking to be sure
k
Spree::Config.image_attachment_module
in a rails console should give a quick answer
g
Nope, apparently I'm wrong
Copy code
config.image_attachment_module = 'Spree::Image::PaperclipAttachment'
looks like it's pretty clearly paperclip 😛
k
👍
Ok, if you override the image attaching directive you should be able to specify which format you do want the image to be saved. See: https://github.com/thoughtbot/paperclip/issues/1190
With this command, you can also re-generate all the already uploaded images.
g
Oh dang, you've got all kinds of goodies for me. This is much appreciated!
k
This is what Solidus defaults to: https://github.com/solidusio/solidus/blob/cc56661f4faa0c1cadbf979bef6fddbc53509e54/core/app/models/spree/image/paperclip_attachment.rb#L9-L15 Please, be aware that this code could change depending on your Solidus version
You are welcome!
t
Hopefully Solidus will make the switch over to libvips soon: https://github.com/libvips/libvips/wiki/Speed-and-memory-use Another thing which I'm about to try is www.removebg.com 👍