使用Carrierwave上传到Cloudinary时添加“备份”选项

时间:2014-06-19 16:44:28

标签: carrierwave cloudinary

我在此处http://cloudinary.com/documentation/rails_carrierwave

为Cloudinary创建了一个Carrierwave上传器

看起来像这样:

class MatePictureUploader < CarrierWave::Uploader::Base

  include Cloudinary::CarrierWave

  def public_id
    "mate/picture/#{model.id}" 
  end

  version :thumb do
    process :resize_to_fill => [110, 110, :north]
  end

end

现在我想传递&#34;备份&#34;上传选项,以便cloudinary保留其版本(我不想在我的Cloudinary帐户上全局激活该选项)。

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

可以使用cloudinary_transformation方法将选项传递给Cloudinary。

对于&#34;备份&#34;选项,它看起来像这样:

class MatePictureUploader < CarrierWave::Uploader::Base

  include Cloudinary::CarrierWave

  cloudinary_transformation backup: true

  def public_id
    "mate/picture/#{model.id}" 
  end

  version :thumb do
    process :resize_to_fill => [110, 110, :north]
  end

end