我正在一个Rails网站上工作,该网站需要在Cloudinary上私有上传图片。现在,它正在Cloudinary上公开上传图像。
我可以使用以下命令在Cloudinary上手动上传私有文件:
Cloudinary::Uploader.upload("Photo No. 11.jpeg", :type => :private)
图片变为私有且无法访问。
有没有办法用Carrierwave做到这一点?
答案 0 :(得分:2)
您应该在上传器中执行类似的操作
class PictureUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave
make_private # This will make sure you're images are uploaded as private
eager
version :medium do
process :resize_to_fill => [164, 164, 'North']
process :convert => 'jpg'
cloudinary_transformation :quality => 80
end
end