码迷,mamicode.com
首页 > 其他好文 > 详细

openerp report image

时间:2014-09-18 20:36:04      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   使用   for   文件   div   sp   代码   

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

%>

 

openerp report image

标签:style   blog   color   使用   for   文件   div   sp   代码   

原文地址:http://www.cnblogs.com/alangwansui/p/3979908.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!