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

%>

 

相关文章:

  • 2021-08-08
  • 2022-12-23
  • 2021-06-17
  • 2022-01-06
  • 2022-02-18
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-18
  • 2021-07-16
  • 2022-12-23
  • 2022-01-26
  • 2021-07-31
  • 2021-08-17
  • 2022-12-23
相关资源
相似解决方案