简体   繁体   English

使用自定义buildpack for heroku imagemagick

[英]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. 我正在使用rails paperclip和imagemagick来处理我的图像上传,我发现heroku上的图像比最初的图像要暗,特别是黑白图像。 After digging around I've found that it has something to do with their version of imagemagick. 在挖掘之后,我发现它与他们的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: 然后在我的应用程序中创建一个.buildpacks文件,其中包含以下内容:

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? 我不熟悉buildpacks,所以我只是创建一个名为.buildpacks的文件,如果是这样,我在哪里将文件放在我的应用程序中? 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. 有一个新的过程,你可以通过heroku添加,你不再需要.buildpacks文件。 Try 尝试

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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