asp动态生成wbmp图片的程序
(ASP2001)
<%@ Language=VBScript %>
<%
'函数1:
'将字符串转换成二进制
Function StoB(varstr)
str2bin = ""
For i = 1 To Len(varstr)
varchar = Mid(varstr, i, 1)
str2bin = str2bin & ChrB(AscB(varchar))
Next
StoB = str2bin
End Function
'函数2:
'将每两个字符前面加"&H"表示是十六进制,然后把"&H??"加到"chr()"里面
'具体功能是什麽,我也说不清,反正是必须的
Function SS(varstr)
BB = ""
For i = 1 To Len(varstr)/2
varchar = "&H" & Mid(varstr, 2*i-1, 2)
BB=BB & chr(varchar)
Next
SS = BB
End Function
img="00001414faf5f0fb6df0fbadf0fbdd801bfc70e71fe07ce7d0bbfbd0dbfbb0d7fd70b7fdb077f5d0fbebe0fbdbf01ce780c71c70f7fdf0f7bff0f65df0f5edf00"
'这段字符串的含义参考我以前的帖子
'当然也可以由程序根据数据自动生成这段字符串,前提是你了解这段字符串的含义并有足够的耐心,想想吧,生成一个100X100的
图片,要由1250个类似"F0"的字符组成!
Response.ContentType="image/vnd.wap.wbmp"
Response.BinaryWrite stob(ss(img))