Rails/Spree image problems with the color or the quality after to upload them to Heroku

Rails/Spree image problems with the color or the quality after to upload them to Heroku

Hello guys I want to share with you about this problems with wrong color or quality for the uploaded images using Paperclip gem, Imagemagick and Heroku.com.

The fix that we did it is related with the Imagemagick configuration and updates in order to fix this problem you have to do the following actions:

First you have to set a new environment variables on heroku running the following command:

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

Then, create a .buildpacks file inside your app with the following content:

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

And that’s it just push again these changes and upload a new image and you are going to see that the quality and color are betters.

Just in case keep this configuration in reference in case that the previous code doesn’t work for you

has_attached_file(
 :avatar,
 :styles => { :large => "300x300", :small => "100x100" },
 :convert_options => { all => "-colorspace RGB" }
)

Keep in touch

H.

No Comments

Post A Comment