這裡是我根據gif圖像格式想出來的判斷gif圖像尺寸的方法,請大家給點意見
up.htm
<Html>
<body>
<form action="up.ASP" ENCTYPE="multipart/form-data" method="post">
<table border=0 width=100% cellspacing="0">
<tr>
<td width="30%">請選擇您要上傳的gif圖片:</td>
<td width="70%"><input type="file" name="pic" ></td>
</tr>
</table>
<p align="center"><input type="submit" value="提交" >
</form>
</body>
</Html>
up.ASP
<%
FormSize = Request.TotalBytes
FormData = Request.BinaryRead( FormSize )
bncrlf=chrb(13) & chrb(10)
divider=leftb(formdata,instrb(formdata,bncrlf)-1)
datastart=instrb(formdata,bncrlf & bncrlf)+4
dataend=instrb(datastart+1,formdata,divider)-datastart
Image=midb(formdata,datastart,dataend)
head_version = Ascb( midb( Image,1,3 ) )
head_subversion = Ascb( midb( Image,4,3 ) )
head_width_l = Ascb( midb( Image,7,1 ) )
head_width_h = Ascb( midb( Image,8,1 ) )
head_height_l = Ascb( midb( Image,9,1 ) )
head_height_h = Ascb( midb( Image,10,1 ) )
head_colors = Ascb( midb( Image, 11, 1 ) )
head_width_h = head_width_h * 256
head_height_h = head_height_h * 256
head_colors = head_colors And &H07
Response.Write "圖像大小為" & head_width_h + head_width_l & "x" & head_height_h + head_height_l _
& "x" & 2^( head_colors + 1 )
%>