openerp report image

webkit : 再mako 文件中插入以下代码, <% %>标签用于再mako中定义代码或者函数。 

             然后  ${ embed_image('图片类型', 图片字段 , 宽度,高度)  } 即可, 本质上是使用html中显示 base64格式的图片标签

       <img $width $heigh src="data:image/$tytpe;base64,$strng_of_base64" />
<%
def embed_image(type, img, width=0, height=0) :
    "Transform a DB image into an embedded HTML image"

    if width :
        width = 'width="%spx"'%(width)
    else :
        width = ' '
    if height :
        height = 'height="%spx"'%(height)
    else :
        height = ' '
    toreturn = '<img %s %s src="data:image/%s;base64,%s" />'%(
        width,
        height,
        type, 
        str(img))
    return toreturn

%>
原文地址:https://www.cnblogs.com/alangwansui/p/3979908.html