emrekutlu / paperclip-compression

image compression processor for Paperclip
MIT License
72 stars 37 forks source link

Use OS binaries instead of vendorized binaries #20

Closed marclennox closed 6 years ago

marclennox commented 7 years ago

Paperclip compression doesn't work on Alpine Linux because of the vendorized binaries. Is there a setting to force this gem to use native OS installed binaries instead?

emrekutlu commented 7 years ago

No, there isn't a way to do that. But sounds like a good feature to add.

pdfrod commented 6 years ago

I've run into this issue on Alpine too. The binaries in the repo only work with glibc and using libc6-compat doesn't help either. So it would be nice to have the option of using native binaries.

emrekutlu commented 6 years ago

@pdfrod I made some changes on develop branch. Now options accepts a hash. Can you test it?

In your Gemfile:

gem 'paperclip-compression', github: 'emrekutlu/paperclip-compression', branch: 'develop'

In you model:

class User < ActiveRecord::Base
  has_attached_file :avatar,
    styles: {
      thumb: {
        geometry: '100x100>',
        processor_options: {
          compression: {
            jpeg: {
              command: '/path/to/jpegtran',
              options: '-copy none -optimize'
            }
          }
        }
      }
    },
    processors: [:thumbnail, :compression]
end
pdfrod commented 6 years ago

@emrekutlu I've just tested and it works. Thanks!

emrekutlu commented 6 years ago

Great. 1.0.0 released. No backward incompatible changes. You can upgrade right away.