ASP高手请进有急事

pdmwxy 2006-11-21 11:54:39
有哪位高手会把一段文字转换成图片的,请您帮帮我好吗 我急用 就是像起点中文网那样的 ,能做出来个例子发到我信箱吗,发完了把您的信箱告诉我 然后我给您分数 谢谢啦
...全文
277 点赞 收藏 16
写回复
16 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
themass 2006-11-22
ASPJPEG组件有这个功能,我用过
回复
兔子党-连长 2006-11-22
jf
回复
hreoghost 2006-11-22
mark
回复
Mapleleaf123 2006-11-22
LZ看看ASPJPEG组件```
回复
可西哥 2006-11-22
直接用图片组件
回复
hymxtang 2006-11-22
帮ding
回复
vitor_lt 2006-11-22
用ASP生成XBM数字图片
XBM图片是一个纯文本的文件,可以用ASP来自动生成。可以用它来使用网站登陆的验证码;
我们用记事本打开该文件进行分析:
其文件结构为:
#define counter_width 48
#define counter_height 9
static unsigned char counter_bits[]={7c,3c,7c,3c,70,3c,fe,7c,fe,7c,78,7c,ee,ee,ee,ee,7c,ee,e0,ee,60,ee,74,ee,70,fe,30,fe,70,fe,38,ec,e0,ec,70,ec,1c,e0,ee,e0,70,e0,fe,7e,fe,7e,70,7e,fe,3c,7c,3c,70,3c}
文件扩展名为:.xbm

#define counter_width 48 '这儿定义的是图片的宽度,一般为8的倍数
#define counter_height 9 '这儿定义的是图片的高度,是任意的。
static unsigned char counter_bits[]={7c,3c,7c,3c,70,3c,fe,7c,fe,7c,78,7c,ee,ee,ee,ee,7c,ee,e0,ee,60,ee,74,ee,70,fe,30,fe,70,fe,38,ec,e0,ec,70,ec,1c,e0,ee,e0,70,e0,fe,7e,fe,7e,70,7e,fe,3c,7c,3c,70,3c} '这儿是图片用来显示内容的十六进制的代码

正如static unsigned char英文意思为静态的,无符号的,烧焦的。它只能用来显示黑白两种颜色。二进制中的1将来用显示为黑色,0为白色。

下面为0~9数字的二进制数组(其中的图片样式仅试用于本例。如果需要别的0~9数字样式,请另自行生成)

'此处声明0~9绘图用数组

dim num(9,8)
'数字0
num(0,0)="0x38"
num(0,1)="0x7c"
num(0,2)="0xee"
num(0,3)="0xee"
num(0,4)="0xee"
num(0,5)="0xee"
num(0,6)="0xee"
num(0,7)="0x7c"
num(0,8)="0x38"
'数字1
num(1,0)="0x70"
num(1,1)="0x78"
num(1,2)="0x7c"
num(1,3)="0x74"
num(1,4)="0x70"
num(1,5)="0x70"
num(1,6)="0x70"
num(1,7)="0x70"
num(1,8)="0x70"
'数字2
num(2,0)="0x7c"
num(2,1)="0xfe"
num(2,2)="0xee"
num(2,3)="0xe0"
num(2,4)="0x70"
num(2,5)="0x38"
num(2,6)="0x1c"
num(2,7)="0xfe"
num(2,8)="0xfe"
'数字3
num(3,0)="0x7c"
num(3,1)="0xfe"
num(3,2)="0xee"
num(3,3)="0x60"
num(3,4)="0x30"
num(3,5)="0xe0"
num(3,6)="0xee"
num(3,7)="0xfe"
num(3,8)="0x7c"
'数字4
num(4,0)="0x70"
num(4,1)="0x78"
num(4,2)="0x7c"
num(4,3)="0x76"
num(4,4)="0x77"
num(4,5)="0xff"
num(4,6)="0xff"
num(4,7)="0x70"
num(4,8)="0x70"
'数字5
num(5,0)="0xfc"
num(5,1)="0xfc"
num(5,2)="0x0c"
num(5,3)="0x7e"
num(5,4)="0xfe"
num(5,5)="0xe0"
num(5,6)="0xee"
num(5,7)="0xfe"
num(5,8)="0x7c"
'数字6
num(6,0)="0x78"
num(6,1)="0xfc"
num(6,2)="0x0e"
num(6,3)="0x6e"
num(6,4)="0xfe"
num(6,5)="0xee"
num(6,6)="0xee"
num(6,7)="0xfc"
num(6,8)="0x78"
'数字7
num(7,0)="0xfe"
num(7,1)="0xfe"
num(7,2)="0x60"
num(7,3)="0x70"
num(7,4)="0x38"
num(7,5)="0x38"
num(7,6)="0x18"
num(7,7)="0x1c"
num(7,8)="0x1c"
'数字8
num(8,0)="0x7c"
num(8,1)="0xfe"
num(8,2)="0xee"
num(8,3)="0x7c"
num(8,4)="0x7c"
num(8,5)="0xee"
num(8,6)="0xee"
num(8,7)="0xfe "
num(8,8)="0x7c"
'数字9
num(9,0)="0x3c"
num(9,1)="0x7c"
num(9,2)="0xee"
num(9,3)="0xee"
num(9,4)="0xfe"
num(9,5)="0xec"
num(9,6)="0xe0"
num(9,7)="0x7e"
num(9,8)="0x3c"


下面实现这个的代码,把上面的数字数组(红色的)保存为funNum.asp
下面的文件部分,单独保存为一个ASP页
<%
response.Buffer=true
response.ExpiresAbsolute=now()-1
response.expires=0
response.CacheControl="no-cache"
%>
<!--#include file="funNum.asp"-->
<!--funNum.asp就是教程里那几个数组//-->
<%
const countHeight=9 '图片的高度
const countlength=6 '图片里数字的位数
const numBinBit=8 '这是数字数组里的二进制位数,好象只能使用八位以下的即11111111
const countWidth=48 'countlength*numBinBit得到
const imgtype="image/x-xbitmap"
dim countBody '图片信息
dim tmpcountbody '用于存放后面生成的图片数据
tmpcountbody=""
countBody="#define js_counter_width " & countWidth & vbCrLf
countBody=countBody & "#define js_counter_height " & countHeight & vbCrLf
countBody=countBody & "static unsigned char js_counter_bits[]={" & vbCrLf
dim numid '需要生成图片的数字
dim numarray() '将取得的numid分割成一个个的数字组成一维数组
numid="369245" '编写一个函数用来生成数字即可
if len(numid)<countLength then
for i=1 to countLength-len(numid)
numid="0" & numid
next
end if
redim numarray(len(numid)-1) '直接定义数组时要指字一整型数值,重定义数组大小时可使用表达式
for i=0 to ubound(numarray,1)
numarray(i)=mid(numid,i+1,1)
next
for i=0 to countHeight-1
for j=0 to countlength-1
tmpcountbody=tmpcountbody & num(numarray(j),i) & ","
next
next
tmpcountbody=left(tmpcountbody,len(tmpcountbody)-1)
countBody=countBody & tmpcountbody & "}"
response.contenttype=imgtype
response.write countBody
%>
回复
vitor_lt 2006-11-22
用ASP生成BMP图片
生成彩色随机验证码的程序
<%

Response.ContentType = "Image/BMP"

Call Com_CreatValidCode()

Sub Com_CreatValidCode()

Randomize

Dim i, ii, iii

Const cAmount = 36 '数值个数

Const cCode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" '数值范围

Dim vColorData(2)

vColorData(0) = "" '黑色点要转为彩色点,暂时不定义

vColorData(1) = ChrB(255) & ChrB(255) & ChrB(255) '白点

Dim vCode(4), vCodes '产生一组任意数

For i = 0 To 3

vCode(i) = Int(Rnd * cAmount) '数组等于总数*随机数

vCodes=vCodes&Mid(cCode,vCode(i)+1,1) '串等于串加上后续值

Next

session("checkcode")=vCodes '记录产生的串值

Dim vNumberData(36)

vNumberData(0) = "1110000111110111101111011110111101001011110100101111010010111101001011110111101111011110111110000111"

vNumberData(1) = "1111011111110001111111110111111111011111111101111111110111111111011111111101111111110111111100000111"

vNumberData(2) = "1110000111110111101111011110111111111011111111011111111011111111011111111011111111011110111100000011"

vNumberData(3) = "1110000111110111101111011110111111110111111100111111111101111111111011110111101111011110111110000111"

vNumberData(4) = "1111101111111110111111110011111110101111110110111111011011111100000011111110111111111011111111000011"

vNumberData(5) = "1100000011110111111111011111111101000111110011101111111110111111111011110111101111011110111110000111"

vNumberData(6) = "1111000111111011101111011111111101111111110100011111001110111101111011110111101111011110111110000111"

vNumberData(7) = "1100000011110111011111011101111111101111111110111111110111111111011111111101111111110111111111011111"

vNumberData(8) = "1110000111110111101111011110111101111011111000011111101101111101111011110111101111011110111110000111"

vNumberData(9) = "1110001111110111011111011110111101111011110111001111100010111111111011111111101111011101111110001111"

vNumberData(10) = "1111011111111101111111101011111110101111111010111111101011111100000111110111011111011101111000100011"

vNumberData(11) = "1000000111110111101111011110111101110111110000111111011101111101111011110111101111011110111000000111"

vNumberData(12) = "1110000011110111101110111110111011111111101111111110111111111011111111101111101111011101111110001111"

vNumberData(13) = "1000001111110111011111011110111101111011110111101111011110111101111011110111101111011101111000001111"

vNumberData(14) = "1000000111110111101111011011111101101111110000111111011011111101101111110111111111011110111000000111"

vNumberData(15) = "1000000111110111101111011011111101101111110000111111011011111101101111110111111111011111111000111111"

vNumberData(16) = "1110000111110111011110111101111011111111101111111110111111111011100011101111011111011101111110001111"

vNumberData(17) = "1000100011110111011111011101111101110111110000011111011101111101110111110111011111011101111000100011"

vNumberData(18) = "1100000111111101111111110111111111011111111101111111110111111111011111111101111111110111111100000111"

vNumberData(19) = "1110000011111110111111111011111111101111111110111111111011111111101111111110111110111011111000011111"

vNumberData(20) = "1000100011110111011111011011111101011111110001111111010111111101101111110110111111011101111000100011"

vNumberData(21) = "1000111111110111111111011111111101111111110111111111011111111101111111110111111111011110111000000011"

vNumberData(22) = "1000100011110010011111001001111100100111110101011111010101111101010111110101011111010101111001010011"

vNumberData(23) = "1000100011110011011111001101111101010111110101011111010101111101100111110110011111011001111000110111"

vNumberData(24) = "1110001111110111011110111110111011111011101111101110111110111011111011101111101111011101111110001111"

vNumberData(25) = "1000000111110111101111011110111101111011110000011111011111111101111111110111111111011111111000111111"

vNumberData(26) = "1110001111110111011110111110111011111011101111101110111110111011111011101001101111011001111110001011"

vNumberData(27) = "1000001111110111011111011101111101110111110000111111010111111101101111110110111111011101111000110011"

vNumberData(28) = "1110000011110111101111011110111101111111111001111111111001111111111011110111101111011110111100000111"

vNumberData(29) = "1000000011101101101111110111111111011111111101111111110111111111011111111101111111110111111110001111"

vNumberData(30) = "1000100011110111011111011101111101110111110111011111011101111101110111110111011111011101111110001111"

vNumberData(31) = "1000100011110111011111011101111101110111111010111111101011111110101111111010111111110111111111011111"

vNumberData(32) = "1001010011110101011111010101111101010111110101011111001001111110101111111010111111101011111110101111"

vNumberData(33) = "1000100011110111011111101011111110101111111101111111110111111110101111111010111111011101111000100011"

vNumberData(34) = "1000100011110111011111011101111110101111111010111111110111111111011111111101111111110111111110001111"

vNumberData(35) = "1100000011110111011111111101111111101111111110111111110111111111011111111011111111101110111100000011"

Response.BinaryWrite ChrB(66) & ChrB(77) & ChrB(230) & ChrB(4) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) &_

ChrB(0) & ChrB(0) & ChrB(54) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(40) & ChrB(0) &_

ChrB(0) & ChrB(0) & ChrB(40) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(10) & ChrB(0) &_

ChrB(0) & ChrB(0) & ChrB(1) & ChrB(0)

Response.BinaryWrite ChrB(24) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(176) & ChrB(4) &_

ChrB(0) & ChrB(0) & ChrB(18) & ChrB(11) & ChrB(0) & ChrB(0) & ChrB(18) & ChrB(11) &_

ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) & ChrB(0) &_

ChrB(0) & ChrB(0)

For i = 9 To 0 Step -1 '行

For ii = 0 To 3 '字数

For iii = 1 To 10 '像素点

if Mid(vNumberData(vCode(ii)), i * 10 + iii , 1) ="0" then '产生彩色点,减去一个固定值,可使颜色偏深

dim a,b,c

a=abs(Rnd * 256-60)

b=abs(Rnd * 256-128)

c=abs(Rnd * 256-60)

vColorData(0) = ChrB(a) & ChrB(b) & ChrB(c)

Response.BinaryWrite vColorData(Mid(vNumberData(vCode(ii)), i * 10 + iii , 1))

else

dim d,e,f '产生彩色背景,颜色偏浅,也可以随机生成噪点做背景

d=abs(Rnd * 255)

e=abs(Rnd * 255)

f=abs(Rnd * 255)

if d+e+f>580 then

vColorData(1) = ChrB(d) & ChrB(e) & ChrB(f)

Response.BinaryWrite vColorData(Mid(vNumberData(vCode(ii)), i * 10 + iii , 1))

else

Response.BinaryWrite vColorData(Mid(vNumberData(vCode(ii)), i * 10 + iii , 1))

end if

end if

Next

Next

Next

End Sub

%>
回复
vitor_lt 2006-11-22
用ASP生成XBM数字图片
你可以上百度去搜搜这个
原理是用十六进制的代码来做图片,具体怎么做我也不太清楚。
回复
qsj48747776 2006-11-22
把你的文字作为水印加到白背景的图片上!
回复
北京不不 2006-11-22
顶一下....
回复
sangok 2006-11-22
去研究一下,登陆验证码,随机生成4个字符,描绘成BMP的。
回复
gwc0744 2006-11-22
先把图片转换成文字存到数据库里面,把文字转换成图片不就出来了。。。
回复
chenguang79 2006-11-22
楼主你这个功能好相不太可能吧。程序上好相不可能直接就转了。
回复
caibaoying 2006-11-22
友情UP~~~
回复
caibaoying 2006-11-22
可以建个字段 把图片的路径保存进去~~~然后用这个字段替换文字`~~
应该不是很难的呀`~~我是搞JAVA的`~嘿嘿
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2006-11-21 11:54
社区公告
暂无公告