First, on Heroku, you’ll need to add a special buildpack to your slug:
(note that all of the following commands you may need to append with -a if you manage more than one Heroku app)
(Here -i 1 tells the command you want the buildpack at index 1. It’s important that you include this flag or else the Heroku API will add your buildpack before the default build, which is known simply as heroku/ruby)
(If you’d prefer to use ImageMagick 7.0.24, I’ve also made a buildpack for that available here: https://github.com/jasonfb/heroku-buildpack-cedar14-imagemagick704)
You can and should examine what you just added with:
To examine what you just did:
You should see the response:
Buildpack added. Next release on app-xyz will use:
1. https://github.com/jasonfb/heroku-buildpack-imagemagick695
2. heroku/ruby
Run git push heroku master to create a new release using these buildpacks.
To undo what you just did
Then push your app to your repo. You will notice it takes a few minutes to compile the new ImageMagick binary and install it into the slug.
You can set the :convert_options in your paperclip definitions, or to make a global change to all your definitions use a monkeypatch like so:
Create a file for paperclip init if you don’t already have one
Monkeypatch the Paperclip processor with the resize filter of your choice.
class Processor
def convert(arguments = “”, local_options = {})
if (arguments =~ /-resize/)
arguments.sub!(“-resize”, “-filter Lanczos -resize”)
end
Paperclip.run(‘convert’, arguments, local_options)
end
end
end
You can read all about the kinds of filters here.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?