【问题标题】:Using carrierwave to upload images as private on cloudinary from Rails使用carrierwave从Rails上传私有图片
【发布时间】:2018-09-18 23:17:52
【问题描述】:

我正在开发一个 Rails 网站,该网站需要在 Cloudinary 上将图片上传为私有。现在它在 Cloudinary 上公开上传图片。

我可以使用以下命令在 Cloudinary 上手动上传私有文件:

Cloudinary::Uploader.upload("Photo No. 11.jpeg", :type => :private)

图像变得私密且无法访问。

有没有办法用 Carrierwave 做到这一点?

【问题讨论】:

    标签: ruby-on-rails carrierwave


    【解决方案1】:

    你应该在你的上传器中做这样的事情

    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
    

    【讨论】:

      猜你喜欢
      • 2013-01-31
      • 1970-01-01
      • 2017-03-02
      • 2014-02-12
      • 1970-01-01
      • 2019-06-04
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      相关资源
      最近更新 更多