ASP

本类阅读TOP10

·asp常用数据库连接方法和技巧
·无组件生成BMP验证码
·一些常用的辅助代码 (网络收藏)
·JavaScript实现的数据表格:冻结列、调整列宽和客户端排序
·VisualStudio.NET_2003及其 MSDN 下载地址
·ASP模拟MVC模式编程
·图片以二进制流输出到网页
·MD5加密算法 ASP版
·ASP.NET编程中的十大技巧
·改进 ASP 的字符串处理性能

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
按比例显示图片,读OLE对象图片的方法

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

<!--#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
%>


相关文章

相关软件