为什么两种方式显示数据库字段中保存的十六进制的图片都不行呢
第一种方式:
elseif sName="jpg" or sName="jpeg" or sName="gif" or sName="png" or sName="bmp" or sName="wbmp" then '图片数据,用标签显示
response.Write "3===="
nHeight=rs2("Height")
nWidth=rs2("Width")
contents="<img alt='天气' src='showimgs.asp?id="& Id &"&format=" & sName'/>"
Response.ContentType "image/"&sName
Response.Charset "utf-8"
response.Write contents
结果:页面中输出了3====没有图片内容,只看到图片标签了,在showimgs.asp页面中是通过id重新查找存放图片的字段(image类型数据,十六进制的)
第二种方式:
elseif sName="jpg" or sName="jpeg" or sName="gif" or sName="png" or sName="bmp" or sName="wbmp" then '图片数据,用字节流显示
response.Write "2===="
nHeight=rs2("Height")
nWidth=rs2("Width")
Response.ContentType "image/" & sName
contents = rs("recorddata")
Response.BinaryWrite contents
结果:页面中没有图片标签也图片内容,只输出了2====
谢谢!高手们请指点迷津,这个问题看似不难哦,可是就是不出来