【问题标题】:Cloudinary, Carrierwave - setting resource_type to rawCloudinary,Carrierwave - 将 resource_type 设置为 raw
【发布时间】:2013-09-01 21:24:26
【问题描述】:

我在 Heroku 主机上设置了 Cloudinary 和 CarrierWave。 我需要上传 SVG,我被告知将“resource_type”设置为“raw” Cloudinary DOCS

我尝试在我的carrierwave上传器中设置它:

process :resource_type
def resource_type
  return :resource_type => "raw"
end

但它没有用。你能帮忙吗?

【问题讨论】:

    标签: ruby-on-rails-3 heroku carrierwave cloudinary


    【解决方案1】:

    Cloudinary CarrierWave code 在内部使用方法 resource_type,像这样覆盖它会破坏代码。 如果您需要将 resource_type 覆盖为 raw,您可以使用:

    cloudinary_transformation :resource_type=>:raw
    

    但是,这通常不是必需的,因为 Cloudinary 可以正确检测图像与原始图像。

    【讨论】:

    • 我使用了Cloudinary::Api.resources(:resource_type => :raw),它成功了。我不知道是什么问题,也许是 Heroku Cloudinary? png也发生了同样的事情。我必须指定process :convert => 'png'。谢谢它的工作。
    猜你喜欢
    • 2013-06-17
    • 2015-10-22
    • 2018-05-19
    • 2011-10-04
    • 2018-06-09
    • 2016-12-22
    • 2014-12-01
    • 2017-10-08
    • 2019-01-24
    相关资源
    最近更新 更多