·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 处理图片、文章的程序

处理图片、文章的程序

类别: ASP教程  评论数:0 总得分:0
刚写的,能执行但没有整理,如果看例子就看WWW.HIFI-CHINA.COM中的显示的文章。图片做到随机定位,切满足不同的对齐、边框、图注要求。并带有UBB支持模块,但在这里去掉了:)

<SCRIPT LANGUAGE=VBscript RUNAT=Server>

function getarticle(articleid,showtitle,prubb)
showpicture=true
articletext=""
set articledbc = server.createobject("adodb.command")
set ars = server.createobject("adodb.recordset")
ars.open "select * from article_comm where article_id=" & articleid,session("ds"),1,1
if not ars.eof then
article_id=ars("article_id")
article_title=rtrim(ars("title"))
article_comm=server.htmlencode(ars("comm"))
article_date=datevalue(ars("adddate"))
ars.close
articledbc.ActiveConnection=session("ds")
articledbc.commandtext="UPDATE article_comm SET showcounter = showcounter + 1, lastread = GETDATE() WHERE (article_id = " & article_id & ")"
articledbc.execute
if showpicture then
ars.open "SELECT article_pic.article_id, article_pic.pic_id, article_pic.loctrate, article_pic.align, article_pic.show_sq, article_pic.style, PicLab.picurl, PicLab.pic_sq, PicLab.pic_comm, PicLab.pic_linkout FROM article_pic INNER JOIN PicLab ON article_pic.pic_id = PicLab.pic_id where (article_id = " & article_id & ") order by loctrate",session("ds"),1,1
dim addpic()
dim toarticle()
redim addpic(ars.recordcount -1)
redim toarticle(ars.recordcount)

for i = 1 to ars.recordcount
addpictemp=""

thepoint=clng(cdbl(ars("loctrate"))* (1-lastloctrate) * len(article_comm))
lastloctrate=cdbl(ars("loctrate"))
toarticle(i-1)=left(article_comm,thepoint)
article_comm=right(article_comm,len(article_comm)-thepoint)
select case ars("align")
case 0
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table border=""0"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=2 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"">"
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table width=""32"" height=""32"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=0 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td align=""center"">"
addpictemp= addpictemp + "<img border=""0"" "

if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + " title=""" + server.htmlencode(ars("pic_comm")) +""" "
end if
addpictemp= addpictemp +" src="""
addpictemp= addpictemp + SESSION("Image_lab") +"/"+rtrim(ars("picurl"))
addpictemp= addpictemp + """ ></td>"
addpictemp= addpictemp + "</tr>"
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
addpictemp= addpictemp + "</td>"
addpictemp= addpictemp + "</tr>"
if ars("show_sq") =1 or ars("show_sq") =3 then
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"" nowrap align=""center"" valign=""top"" >"
addpictemp= addpictemp +"<font size=""2"" color=""#999999"">"
addpictemp= addpictemp + rtrim(ars("pic_sq"))
addpictemp= addpictemp +"</font>"
if ucase(ars("pic_linkout"))<>"[N/A]" then
addpictemp= addpictemp + "<a href="""
addpictemp= addpictemp + rtrim(ars("pic_linkout"))
addpictemp= addpictemp +""" target=""_blank""><img border=""0"" src=""/systemimages/linkout.gif"" valign=""right"" width=""11"" height=""11""></a>"
end if
addpictemp= addpictemp + "</td>"
addpictemp= addpictemp + "</tr>"
end if
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
case 1
addpictemp= addpictemp + "<div align=""left"">"
addpictemp= addpictemp + "<table border=""0"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=2 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"">"
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table width=""32"" height=""32"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=0 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td align=""center"">"
addpictemp= addpictemp + "<img border=""0"" "

if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + " title=""" + server.htmlencode(ars("pic_comm")) +""" "
end if
addpictemp= addpictemp +" src="""
addpictemp= addpictemp + SESSION("Image_lab") +"/"+rtrim(ars("picurl"))
addpictemp= addpictemp + """ ></td>"
addpictemp= addpictemp + "</tr>"
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
addpictemp= addpictemp + "</td>"
addpictemp= addpictemp + "</tr>"
if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"" nowrap align=""center"" valign=""top"" >"
if ucase(ars("pic_linkout"))<>"[N/A]" then
addpictemp= addpictemp + "<a href="""
addpictemp= addpictemp + server.urlencode(rtrim(ars("pic_linkout")))
addpictemp= addpictemp +"""><img border=""0"" src=""/systemimages/linkout.gif"" align=""right"" width=""11"" height=""11""></a>"
end if
addpictemp= addpictemp +"<font size=""2"" color=""#999999"">"
addpictemp= addpictemp + rtrim(ars("pic_sq"))
addpictemp= addpictemp +"</font>"
addpictemp= addpictemp +"</td>"
addpictemp= addpictemp + "</tr>"
end if
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
case 2
addpictemp= addpictemp + "<div align=""right"">"
addpictemp= addpictemp + "<table border=""0"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=2 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"">"
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table width=""32"" height=""32"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=0 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td align=""center"">"
addpictemp= addpictemp + "<img border=""0"" "

if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + " title=""" + server.htmlencode(ars("pic_comm")) +""" "
end if
addpictemp= addpictemp +" src="""
addpictemp= addpictemp + SESSION("Image_lab") +"/"+rtrim(ars("picurl"))
addpictemp= addpictemp + """ ></td>"
addpictemp= addpictemp + "</tr>"
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
addpictemp= addpictemp + "</td>"
addpictemp= addpictemp + "</tr>"
if ars("show_sq") =1 or ars("show_sq") =3 then
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"" nowrap align=""center"" valign=""top"" >"
if ucase(ars("pic_linkout"))<>"[N/A]" then
addpictemp= addpictemp + "<a href="""
addpictemp= addpictemp + server.urlencode(rtrim(ars("pic_linkout")))
addpictemp= addpictemp +"""><img border=""0"" src=""/systemimages/linkout.gif"" align=""right"" width=""11"" height=""11""></a>"
end if
addpictemp= addpictemp +"<font size=""2"" color=""#999999"">"
addpictemp= addpictemp + rtrim(ars("pic_sq"))
addpictemp= addpictemp +"</font>"
addpictemp= addpictemp +"</td>"
addpictemp= addpictemp + "</tr>"
end if
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</div>"
case 3
addpictemp= addpictemp + "<table border=""0"" cellpadding=""0"" cellspacing=""0"" align=""left"" "
if ars("style")=2 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"">"
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table width=""32"" height=""32"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=0 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td align=""center"">"
addpictemp= addpictemp + "<img border=""0"" "

if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + " title=""" + server.htmlencode(ars("pic_comm")) +""" "
end if
addpictemp= addpictemp +" src="""
addpictemp= addpictemp + SESSION("Image_lab") +"/"+rtrim(ars("picurl"))
addpictemp= addpictemp + """ ></td>"
addpictemp= addpictemp + "</tr>"
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
addpictemp= addpictemp + "</td>"
addpictemp= addpictemp + "</tr>"
if ars("show_sq") =1 or ars("show_sq") =3 then
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"" nowrap align=""center"" valign=""top"" >"
if ucase(ars("pic_linkout"))<>"[N/A]" then
addpictemp= addpictemp + "<a href="""
addpictemp= addpictemp + server.urlencode(rtrim(ars("pic_linkout")))
addpictemp= addpictemp +"""><img border=""0"" src=""/systemimages/linkout.gif"" align=""right"" width=""11"" height=""11""></a>"
end if
addpictemp= addpictemp +"<font size=""2"" color=""#999999"">"
addpictemp= addpictemp + rtrim(ars("pic_sq"))
addpictemp= addpictemp +"</font>"
addpictemp= addpictemp +"</td>"
addpictemp= addpictemp + "</tr>"
end if
addpictemp= addpictemp + "</table>"
case 4
addpictemp= addpictemp + "<table border=""0"" cellpadding=""0"" cellspacing=""0"" align=""right"" "
if ars("style")=2 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"">"
addpictemp= addpictemp + "<div align=""center"">"
addpictemp= addpictemp + "<center>"
addpictemp= addpictemp + "<table width=""32"" height=""32"" cellpadding=""0"" cellspacing=""0"" "
if ars("style")=0 then
addpictemp= addpictemp + "style=""border-collapse: collapse; border-style: solid; border-width: 1"" bordercolor=""#111111"" "
end if
addpictemp= addpictemp + ">"
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td align=""center"">"
addpictemp= addpictemp + "<img border=""0"" "

if ars("show_sq") =2 or ars("show_sq") =3 then
addpictemp= addpictemp + " title=""" + server.htmlencode(ars("pic_comm")) +""" "
end if
addpictemp= addpictemp +" src="""
addpictemp= addpictemp + SESSION("Image_lab") +"/"+rtrim(ars("picurl"))
addpictemp= addpictemp + """ ></td>"
addpictemp= addpictemp + "</tr>"
addpictemp= addpictemp + "</table>"
addpictemp= addpictemp + "</center>"
addpictemp= addpictemp + "</div>"
addpictemp= addpictemp + "</td>"
addpictemp= addpictemp + "</tr>"
if ars("show_sq") =1 or ars("show_sq") =3 then
addpictemp= addpictemp + "<tr>"
addpictemp= addpictemp + "<td width=""100%"" nowrap align=""center"" valign=""top"" >"
if ucase(ars("pic_linkout"))<>"[N/A]" then
addpictemp= addpictemp + "<a href="""
addpictemp= addpictemp + server.urlencode(rtrim(ars("pic_linkout")))
addpictemp= addpictemp +"""><img border=""0"" src=""/systemimages/linkout.gif"" align=""right"" width=""11"" height=""11""></a>"
end if
addpictemp= addpictemp +"<font size=""2"" color=""#999999"">"
addpictemp= addpictemp + rtrim(ars("pic_sq"))
addpictemp= addpictemp +"</font>"
addpictemp= addpictemp +"</td>"
addpictemp= addpictemp + "</tr>"
end if
addpictemp= addpictemp + "</table>"

end select

addpic(i-1)=addpictemp
setpiccounter ars("pic_id")
ars.movenext
next
ars.close
for i = 0 to ubound(addpic)
articletext=articletext & toarticle(i) & addpic(i)
next
articletext=articletext & article_comm
end if
end if
if prubb then
end if
if showtitle then
articletext=article_title+"<br>"+articletext
end if
getarticle=(articletext)
end function
</script>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1