这里是我根据gif图像格式想出来的判断gif图像尺寸的方法,请大家给点意见
up.htm
1<html>
2<body>
3<form action="up.asp" enctype="multipart/form-data" method="post">
4<table border="0" cellspacing="0" width="100%">
5<tr>
6<td width="30%">请选择您要上传的gif图片:</td>
7<td width="70%"><input name="pic" style="font-size:10pt;" type="file"/></td>
8</tr>
9</table>
10<p align="center"><input style="font-size:9pt;background-color:#54B060;color:white;" type="submit" value="提交"/>
11</p></form>
12</body>
13</html>
up.asp
1
2
3FormSize = Request.TotalBytes
4FormData = Request.BinaryRead( FormSize )
5
6bncrlf=chrb(13) & chrb(10)
7divider=leftb(formdata,instrb(formdata,bncrlf)-1)
8datastart=instrb(formdata,bncrlf & bncrlf)+4
9dataend=instrb(datastart+1,formdata,divider)-datastart
10Image=midb(formdata,datastart,dataend)
11
12head_version = Ascb( midb( Image,1,3 ) )
13head_subversion = Ascb( midb( Image,4,3 ) )
14
15head_width_l = Ascb( midb( Image,7,1 ) )
16head_width_h = Ascb( midb( Image,8,1 ) )
17
18head_height_l = Ascb( midb( Image,9,1 ) )
19head_height_h = Ascb( midb( Image,10,1 ) )
20
21head_colors = Ascb( midb( Image, 11, 1 ) )
22
23head_width_h = head_width_h * 256
24
25head_height_h = head_height_h * 256
26
27
28head_colors = head_colors And &H07
29
30Response.Write "图像大小为" & head_width_h + head_width_l & "x" & head_height_h + head_height_l _
31& "x" & 2^( head_colors + 1 )
32
33