当表单出错时,不会显示缓存的图像。它试图访问Cloudinary服务器并下载一个不存在的图像。
以下是源代码的结果:
<div class="form-group">
<label class="col-sm-3 control-label" for="guide_image">Image</label>
<div class="col-sm-9">
<img alt="Ho97jzyhfjludw129u8m" src="http://res.cloudinary.com/memorycommit/image/upload/ho97jzyhfjludw129u8m.jpg" />
<input class="form-control" id="guide_image" name="guide[image]" type="file" />
<input id="guide_image_cache" name="guide[image_cache]" type="hidden" value="1402249607-3970-6368/mountain-top-med.jpg" />
</div>
</div>
以下是我对图片的查看代码:
<div class="form-group">
<%= f.label :image, class: "col-sm-3 control-label" %>
<div class="col-sm-9">
<%= image_tag(@guide.image_url) if @guide.image? %>
<%= f.file_field :image, class: "form-control" %>
<%= f.hidden_field(:image_cache) %>
</div>
</div>
image_uploader.rb
class ImageUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave
version :standard do
process :resize_to_fill => [220, 220, :north]
end
version :thumbnail do
resize_to_fit(120, 120)
end
end
我做错了什么?
答案 0 :(得分:0)
不幸的是,cl_image_tag
方法并不支持返回本地网址(例如image_cache
中的图片)。