emrekutlu / paperclip-compression

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

No file size reduction #9

Closed fbjork closed 10 years ago

fbjork commented 10 years ago

After enabling paperclip-compression for attached files on my OSX machine I can see a reduction in file size with the default settings. However, when I deploy this to EC2, which is running Ubuntu 12.04, I don't see any effect.

What am I missing?

emrekutlu commented 10 years ago

I have no idea. Maybe adding some code can help. How are you comparing the file sizes? Can you add the file you test?

fbjork commented 10 years ago

@emrekutlu sure, here's what I have in my Gemfile:

gem 'paperclip', '4.2.0'
gem 'paperclip-compression', '0.3.6'

Here's the code from the model:

  has_attached_file :image,
    styles: {
      mini: '87x53>',
      upcoming: '219x133>',
      current: '450x270>',
      large: '530x318>'
    },
    default_style: :current,
    storage: 's3',
    s3_credentials: {
      access_key_id: Rails.application.config.aws_access_key_id,
      secret_access_key: Rails.application.config.aws_secret_access_key
    },
    bucket: Rails.application.config.aws_s3_bucket,
    url: ':s3_alias_url',
    path: ':id/:style.:extension',
    s3_headers: { 'Cache-Control' => "max-age=#{10.years.to_i}" },
    s3_protocol: :https,
    processors: [:thumbnail, :compression]

  validates_attachment_content_type :image, content_type: /\Aimage/

Rails version is 3.2.18 and Ruby 1.9.3-p545

Here's the file that I'm testing with. When I'm resizing it locally on my OSX machine it gets compressed to 44kb from 110kb, but when I try it on EC2 (Ubuntu 12.04) the size says at 110kb.

image

emrekutlu commented 10 years ago

I am sorry, I couldn't reproduce it.

fbjork commented 10 years ago

@emrekutlu do I need to install any OS dependencies for this to work other than imagemagick?

emrekutlu commented 10 years ago

@fbjork no, jpegtran and optipng libraries are included with the gem.