简体   繁体   中英

Using a custom buildpack for heroku imagemagick

I'm using rails paperclip and imagemagick to handle my image uploading and I've found that images on heroku are coming out much darker than they initially were, especially black and white images. After digging around I've found that it has something to do with their version of imagemagick. A solution suggested was to set a variable like so:

heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi

And then to create a .buildpacks file inside my app with the following content:

https://github.com/mcollina/heroku-buildpack-imagemagick
https://github.com/heroku/heroku-buildpack-ruby.git

I'm not familiar with buildpacks, so do I just create a file called .buildpacks with that content and if so, where do I place the file in my app? Or is it more involved than that?

And I have my models set up to handle image converting like so, if that matters:

has_attached_file :avatar, styles: {activity: "300>", thumb: "30x30#", av: "165x165#", list: "230x230#"},
                  :default_url => '/assets/Events Default.png',
                  :convert_options => {  all: "-set -colorspace sRGB" }

There's a new process, where you can just add via heroku and and you no longer need a .buildpacks file. Try

heroku buildpacks:add --index 1 https://github.com/ello/heroku-buildpack-imagemagick.git

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM