注册 登录
编程论坛 ASP技术论坛

asp图片代码优化问题

szchenli 发布于 2010-06-07 14:38, 642 次点击
小弟我是个asp初学者,碰到个问题请教下?
asp网站上图片打开很慢,图片的格式是gif,读取的是数据库,请问怎么让图片在网页上打开快点?或者是优化下图片代码?
小弟不胜感激。
下面是代码:
<%
Set rs4 = Server.CreateObject ("ADODB.Recordset")
sql4 = "Select top 5 * from spot where url<>'' order by [id] DESC "
rs4.Open sql4,conn,1,1
if rs4.eof or rs4.bof then
else
i=0
a=rs4.RecordCount
dim newpic(5)
dim newlink(5)
dim newtxt(5)
do while (not rs4.eof) and i<cint(a)
newpic(i)="Upload/tour/"&rs4("url")
newlink(i)="spotinfo1.asp?id="&rs4("id")
newtxt(i)=""
i=i+1                    
rs4.movenext
loop

j=0
jxspic=""
do while j<rs4.RecordCount
jxspic=jxspic&newpic(j)&"|"
jxslink=jxslink&newlink(j)&"|"
jxstxt=jxstxt&newtxt(j)&"|"
j=j+1
loop

newjxspic=mid(jxspic,1,cint(Len(jxspic))-1)
newjxslink=mid(jxslink,1,cint(Len(jxslink))-1)
newjxstxt=mid(jxstxt,1,cint(Len(jxstxt))-1)
end if
rs4.close
set rs4 = Nothing
%>

             <script type="text/javascript">
var swf_width=287;
var swf_height=343;
var text_height=12;
var config='5|0xffffff|0xed1510|50|0xffffff|0xed1510|0x000000'
//-- config 参数设置 -- 自动播放时间(秒)|文字颜色|文字背景色|文字背景透明度|按键数字颜色|当前按键颜色|普通按键色彩 --
var files='<%=newjxspic%>'
var links='<%=newjxslink%>'
var texts='<%=newjxstxt%>'
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="Scripts/product2007sp6-1.swf" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="false" />');
document.write('<param name=wmode value="opaque" />');
document.write('<param name="FlashVars" value="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'" />');
document.write('<embed src="Scripts/product2007sp6-1.swf" wmode="opaque" FlashVars="config='+config+'&bcastr_flie='+files+'&bcastr_link='+links+'&bcastr_title='+texts+'& menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www. />');
document.write('</object>');
</script>
6 回复
#2
gupiao1752010-06-07 15:23
数据库里保存的是图片路径,优化图片代码是何意思?
#3
szchenli2010-06-07 15:50
这段代码放到网页上,读取图片的速度好慢
#4
szchenli2010-06-07 15:51
图片的名称放到数据库中
#5
szchenli2010-06-07 15:51
http://www.,网址是这个
#6
gupiao1752010-06-07 16:38
依个人认为:
   这个和代码已经没有直接关系了,这和你的服务器带宽有一定关系,还和你的页面布局有关系,你的整个布局用了表格,而图片都位于表格的列内部,必须等整个表格载入后方能继续加载图片,可以认真看一些比较大型的网站,要吗没有大图片,要吗都是以DIV层结构进行布局,而且服务器速度也非常快!
#7
gupiao1752010-06-07 16:40
参考一下新浪的这个层图,它的图片比你的还要大!
http://tech.
1