3

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?

sausman
  • 253
  • 1
  • 8

3 Answers3

1

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.

ckarbass
  • 3,651
  • 7
  • 34
  • 43
  • 1
    I just created a buildpack with image_optim binaries for Heroku, see : https://github.com/bobbus/image-optim-buildpack – Adrien Coquio Feb 16 '14 at 14:22
0

I have created a gem that allows you to run image_optim on heroku:

https://github.com/mooktakim/image_optim_bin

Mooktakim Ahmed
  • 1,021
  • 1
  • 10
  • 17
0

You're probably looking for this: Heroku Image-Optim Buildpack

Or this: https://github.com/bobbus/image-optim-buildpack

Flavio Wuensche
  • 9,460
  • 1
  • 57
  • 54