开发者

Rails 3/ paperclip/ imagemagick - merging two images

开发者 https://www.devze.com 2023-03-30 02:56 出处:网络
When a user uploads an image in my rails app imagemagick handles two transformations: has_attached_file :photo, :styles => { :listsize => \"50x50#\", :articlesize => \"300x300\" },

When a user uploads an image in my rails app imagemagick handles two transformations:

 has_attached_file :photo, :styles => { :listsize => "50x50#", :articlesize => "300x300" },

a l开发者_StackOverflow社区istsize (square 50x50px) image is produced. Is it possible to at this point merge this image with a standard transparent png that would make the image look more like an icon? (I have the png image, I just want to know if it's possible to render another photo style that has this default transparent png placed over the :listsize image). Thanks


Imagemagick is an entire image processing library and thus anything is possible. Paperclip also supports post processing.

Check the Rmagick documentation http://rmagick.rubyforge.org/

And also the Paperclip documentation on post processing https://github.com/thoughtbot/paperclip

I personally would also advise you to look into carrierwave also https://github.com/jnicklas/carrierwave

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号