<!--#include file="conn.asp"-->
<% width=272:height=229 %>
<% set rs=server.CreateObject("adodb.recordset")
sql="select * from imgbook where id=223 order by id desc"
rs.open sql,conn,1,1
%>
<% w=rs("width"):h=rs("height")
m=w/width:n=h/height
if w>=width or h>=height then
if m>n then
w1=width:h1=h/m
elseif m<n then
h1=height:w1=w/n
else
w1=width:h1=height
end if
else
w1=w:h1=h
end if %>
<a href="product_s.asp?id=<%=rs("ID")%>&title=<%=rs("title")%>">
<img src="showimg.asp?id=<%=rs("id")%>" width=<%=w1%> height=<%=h1%> border="0"></a>
+++++++++++++++showimg.asp++++++++++++++++++++++
<!--#include file="conn.asp"-->
<%
id=clng(trim(request("id")))
/.Trim(string) 返回 String,去除字符串开头及结尾的空格。
CLng(expression) 返回表达式,此表达式已被转换为 Long 子类型的 Variant。. /
if id="" then response.End
response.Expires=0
response.buffer=true
response.Clear()
set rs=server.CreateObject("adodb.recordset")
sql="select * from imgbook where ID="&id&""
rs.open sql,conn,3,1
response.ContentType="image/*"
response.BinaryWrite rs("photo")
rs.close
set rs=nothing
conn.close
set conn=nothing
%>