Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
15262 Lượt xem


is this code is working in Odoo12? because I tried to search in all modules and can't find anywhere that it would be used.


How can I display images from binary field in the Qweb report?


<img t-att-src="'data:image/svg ;base64,%s' % o.barcode"/>
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Well your solutions not working for me and i found my own.


You have to use 

<img  t-att-src="image_data_uri(o.barcode)"


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất


t-attf-src="data:image/png;base64, #{o.barcode}"
or 
t-att-src="'data:image/png;base64,%s' % to_text(o.barcode)"

make sure `barcode` is binary field

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Grf,

Try this: <img t-attf-src="data:image/*;base64,{{o.barcode}}"/>

I hope it will work for you

Regards

Haresh Kansara

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 22
5683
2
thg 3 21
3848
2
thg 3 21
8957
0
thg 12 20
3745
0
thg 5 20
2840