Giter Site home page Giter Site logo

Comments (5)

superp avatar superp commented on July 28, 2024

Is very important bug

from paperclip.

dewski avatar dewski commented on July 28, 2024

I had this problem as well, here is my Paperclip options hash:

{
  :styles => {
    :large => ['500x500>', :png],
    :medium => ['350x350>', :png],
    :small => ['', :png],
    :thumb => ['', :png]
  },
  :processors => lambda { |asset| asset.video? ? [:video_thumbnail] : [:thumbnail] },
  :convert_options => {
    :small => '-resize "215x" +repage -crop "215x160+0+0" -gravity North',
    :thumb => '-resize "50x" +repage -crop "50x50+0+0" -gravity North'
  },
  :default_style => :thumb,
  :default_url => '/images/converting/:style.gif',
  :storage => :s3,
  :bucket => 'ce-stage',
  :s3_credentials => File.expand_path('config/s3.yml', Rails.root),
  :s3_headers => {
    'Expires' => 5.years.from_now
  },
  :path => "revisions/:id_partition/:style.:content_type_extension",
  :url => "/revisions/:id_partition/:style.:content_type_extension"
}

from paperclip.

xxx avatar xxx commented on July 28, 2024

dewski, you are my hero of today.

+1 on this problem.

edit: I ended up going with -resize "80x80^" +repage -gravity north -crop "80x80+0+0" to force a square regardless of original aspect ratio.

from paperclip.

akaspick avatar akaspick commented on July 28, 2024

This is what you need to make it work...

:styles => { :grid => "" },
    :convert_options => {
      :grid => '-resize "200x" -gravity Center -crop "200x125+0+0"'
    }

As dewski shows, you need to remove your size for the main style otherwise paperclip resizes your image before the custom options are run causing :convert_options to be evaluated against a lower resolution version of your image. Also the gravity option needs to be set before the crop option.

from paperclip.

alexgodin avatar alexgodin commented on July 28, 2024

This issue seems to have been resolved by @dewski.

from paperclip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.