| 项目搜索 |
| |
|
代码片段库:
查看代码片段
浏览
| 提交新的代码片段
| 创建代码包
用ASP判断jpg图像尺寸的方法
|
类型:
Sample Code (HOWTO) |
类别:
HTML Manipulation
|
许可证:
GNU General Public License |
语言:
Other Language
|
描述:
用ASP判断jpg图像尺寸
|
该代码片段的版本系列:
片段ID |
下载版本 |
提交时间 |
提交人 |
删除 |
4738 | 1.0 | 2003-10-19 22:10 | cbd001 | |
点击"下载版本"来下载该代码片段.
最新版本的代码片段: 1.0
该方法是通过读取jpg文件头来判断JPG图像的尺寸
<html>
<body>
<form action="up.asp" ENCTYPE="multipart/form-data" method="post">
<table border=0 width=100% cellspacing="0">
<tr>
<td width="30%">请选择您要上传的jpg图片:</td>
<td width="70%"><input type="file" name="pic" style="font-size:10pt;"></td>
</tr>
</table>
<p align="center"><input type="submit" value="提交">
</form>
</body>
</html>
<%
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_height_l = Ascb( midb( Image,165,1 ) )
head_height_h = Ascb( midb( Image,164,1 ) )
head_width_l = Ascb( midb( Image,167,1 ) )
head_width_h = Ascb( midb( Image,166,1 ) )
head_width_h = head_width_h * 256
head_height_h = head_height_h * 256
Response.Write "图像大小为" & head_width_h + head_width_l & "x" & head_height_h + head_height_l
%>
如果您修改了一个代码片段并且觉得很应该让别人共享,您可以把这作为这个代码片段的最新版本提交上来. |
|