carrierwave-aws 和 image_tag 不能很好地协同工作
carrierwave-aws and image_tag not working together well
我只是从这里开始,因为这个问题是在我从 fog 切换到 carrierwave-aws 之后突然出现的。我的图片标签呈现如下:
<%= image_tag(current_user.avatar.thumb.url, class: "img-circle") %>
<img class="img-circle" src="https://xxxx.cloudfront.net/images/xxx.cloudfront.net/user/9/avatar_thumb.png" alt="Avatar thumb">
但 current_user.avatar.thumb.url
输出 https://xxxx.cloudfront.net/user/9/avatar_thumb.png
。
我认为应该在代码下面:
<%= image_tag current_user.avatar_url, :class=> 'img-circle' %>
我不知道你为什么使用 thumb
。
avatar
你的数据库列名
希望能帮到你
哦!
config.asset_host = "https://xxxx.cloudfront.net"
不是:
config.asset_host = "xxxx.cloudfront.net"
我只是从这里开始,因为这个问题是在我从 fog 切换到 carrierwave-aws 之后突然出现的。我的图片标签呈现如下:
<%= image_tag(current_user.avatar.thumb.url, class: "img-circle") %>
<img class="img-circle" src="https://xxxx.cloudfront.net/images/xxx.cloudfront.net/user/9/avatar_thumb.png" alt="Avatar thumb">
但 current_user.avatar.thumb.url
输出 https://xxxx.cloudfront.net/user/9/avatar_thumb.png
。
我认为应该在代码下面:
<%= image_tag current_user.avatar_url, :class=> 'img-circle' %>
我不知道你为什么使用 thumb
。
avatar
你的数据库列名
希望能帮到你
哦!
config.asset_host = "https://xxxx.cloudfront.net"
不是:
config.asset_host = "xxxx.cloudfront.net"