熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

ASP程序將頁面中的電話號碼生成圖片

2013-11-13 10:37:21  來源: .NET編程 

  作用用ASP程序將頁面中的電話號碼生成圖片格式

  以下是引用片段

   以下為引用的內容

  <%
Call Com_CreatValidCode(RequestQueryString(tel))
Public Sub Com_CreatValidCode(pTel)
禁止緩存
ResponseExpires =
ResponseAddHeader Pragmanocache
ResponseAddHeader cachectrolnocache
ResponseContentType = Image/BMP
Randomize
Dim i ii iii rndColorstrLensqlrs
Const cOdds = 雜點出現的機率
Const str=
strLen = len(pTel)
rndColor = ChrB(cint(rnd*)) & ChrB(cint(rnd*)) & ChrB(cint(rnd*))
顏色的數據(字符背景)
Dim vColorData()
vColorData() = ChrB() & ChrB() & ChrB() (黑色)
vColorData() = ChrB() & ChrB() & ChrB() (淺藍色)
vColorData() = ChrB() & ChrB() & ChrB() (黑色)
vColorData() = ChrB() & ChrB() & ChrB() (淺藍色)
vColorData() = ChrB() & ChrB() & ChrB() (黑色)
vColorData() = ChrB() & ChrB() & ChrB() (淺藍色)

  隨機產生字符
Randomize
Dim vCode()
redim vCode(strLen)
For i = To strLen
vCode(i) =instr(strmid(pTeli ))
Next

  字符的數據
Dim vNumberData()
Verdana Font
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
vNumberData() =
輸出圖像文件頭 <br>
ResponseBinaryWrite ChrB() & ChrB() &chrb(((strLen*** ) mod )) & chrb(((strLen*** )/ )mod ) & ChrB((((strLen*** )/ )/)mod ) & ChrB(((((strLen*** )/ )/)/)mod ) & ChrB() & ChrB() &_
ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB() &_
ChrB() & ChrB() & ChrB(strLen*) & ChrB() & ChrB() & ChrB() & ChrB() & ChrB() &_
ChrB() & ChrB() & ChrB() & ChrB()
輸出圖像信息頭
ResponseBinaryWrite ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB()&_
ChrB((strLen***)mod )&ChrB(((strLen***)/)mod )&ChrB((((strLen***)/)/)mod )&ChrB(((((strLen***)/)/)/)mod )&_
ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB()&ChrB() & ChrB() &_
ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB() & ChrB()
For i = To Step 歷經所有行
For ii = To strLen 歷經所有字
For iii = To 歷經所有像素
逐行逐字逐像素地輸出圖像數據
If Rnd * < cOdds Then 隨機生成雜點
ResponseBinaryWrite rndColor
Else
ResponseBinaryWrite vColorData(Mid(vNumberData(vCode(ii)) i * iii ))
End If
Next
Next
Next
End Sub
%>

  將以上代碼保存為imgasp在要顯示電話號碼的位置插入<img src=imgasp?tel=>即可


From:http://tw.wingwit.com/Article/program/net/201311/14148.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.