Carrierwave为处理后的图像添加水印
我尝试使用从多个资源获得的以下代码向处理后的图像添加水印:
def watermark
manipulate! do |img|
logo = Magick::Image.read("#{Rails.root}/assets/images/watermarks/watermark.png").first
img = img.composite(logo, Magick::SouthEastGravity, Magick::OverCompositeOp)
end
end
唯一的问题是,你猜对了,不起作用。 我在日志/控制台中没有收到任何错误
这是我上传并调用的方法,例如:
def function
version :thumb do
process :resize_to_fill => [96, 96]
process :watermark
end
end
关于获取一些日志以了解为什么这不起作用的任何想法?我的系统(OSX)上安装了 Rmagick gems 和 Imagemagick,并且调整图像大小确实可以正常工作。
Im trying to add a watermark to processed images with below code I got from several resources:
def watermark
manipulate! do |img|
logo = Magick::Image.read("#{Rails.root}/assets/images/watermarks/watermark.png").first
img = img.composite(logo, Magick::SouthEastGravity, Magick::OverCompositeOp)
end
end
Only problem is, you guess it, does not work.
I get no errors in log/console whatsoever
This is my method inside my uploaded and called like:
def function
version :thumb do
process :resize_to_fill => [96, 96]
process :watermark
end
end
Any thoughts on getting some logs on why this doesn't work? I have the Rmagick gems and Imagemagick installed on my system (OSX) And resizing of images does work correct.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我就是这样做的,效果很好:
B.
I just do it this way and it works very fine:
B.