I'm trying to get the image_optim gem to work with a Rails 4 app on Heroku's Cedar stack to optimize png/gif/jpeg images.
I threw the required binaries (advpng, gifsicle, jpegoptim, jpegtran, optipng, pngcrush, pngout) into /bin and set ENV['PATH'] = "#{Rails.root}/bin:#{ENV['PATH']}" in an initializer. This works for gifs and pngs, but I'm running into problems with jpegs.
In the rails console I get:
irb(main):001:0> `jpegoptim`
jpegoptim: error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory
How should I go about installing libjpeg on Heroku?
The correct way to deploy binaries to Heroku is to use buildpacks: https://devcenter.heroku.com/articles/buildpacks
Use this one if you want to package up multiple binaries: https://github.com/ddollar/heroku-buildpack-multi
There are a number of buildpacks already created for various binaries, but none for the ones you have listed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With