日期:2014-05-17  浏览次数:20809 次

一个关于获取图片高度和宽度的问题
在网上找了个类,用来判断已知的图片宽度和高度是没有问题的,但是一用上变量就不行了,请问哪里出错了?
类程序文件inc.asp

前台页面:
<!--#include   file= "inc.asp "-->

<%
IMGPath= "111.jpg "

Set   PP=New   ImgWHInfo
W   =   PP.imgW(Server.Mappath(IMGPath))
H   =   PP.imgH(Server.Mappath(IMGPath))
Set   pp=Nothing

Response.Write( " <img   src= ' "&IMGPath& " '   border=0> <br> 宽: "&W& ";高: "&H)
%>

这样执行是没有错的,但是图片一换成变量就出错了。
如:
<%
set   rs=server.createobject( "adodb.recordset ")
rs.open   "select   top   1   images   from   news ",conn,1,1

IMGPath=rs( "images ")

Set   PP=New   ImgWHInfo
W   =   PP.imgW(Server.Mappath(IMGPath))
H   =   PP.imgH(Server.Mappath(IMGPath))
Set   pp=Nothing

Response.Write( " <img   src= ' "&IMGPath& " '   border=0> <br> 宽: "&W& ";高: "&H)
%>

这样的写法,在执行页面时,图片可以显示,但是得不出高度和宽度的值来。

inc.asp文件在回贴中贴出。

------解决方案--------------------
晕 那我就没办法试了,除非你把库给我