我试图显示在后端上传的图像,但是当我在 src 属性中使用它时,它返回一个 json 字符串。奇怪的是,我确实在页面前面使用了相同的方法并且它在那里工作。它在这里不起作用:
<img src="{{ associate.banner }}">
它输出
<img src="{"id":1,"disk_name":"54a7d97d49a03640202890.png","file_name":"buycraftlogo.png","file_size":7146,"content_type":"image\/png","title":null,"description":null,"field":"banner","sort_order":1,"created_at":"2015-01-03 11:58:53","updated_at":"2015-01-03 11:59:12","path":"\/uploads\/public\/54a\/7d9\/7d4\/54a7d97d49a03640202890.png","extension":"png"}">
在这里它确实有效:
{% set img = member.profile_img %}
<img src="{{ img }}" class="responsive-img">
我究竟做错了什么?