精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>情感世界>>○ 围城内外>>【围城版务】>>【意见与建议】>>教你做会变的图啊——谁会?

主题:教你做会变的图啊——谁会?
发信人: qxiao8856(飞飞飞)
整理人: imstella(2004-07-11 15:11:59), 站内信件
不知道大家对这些图片的的做法有没有兴趣?呵呵,这天我在网上终于找到了做法,跟大家分享一下。 
首先你要有一个支持ASP的空间,以便放图片,其实实现的这个效果是一段ASP代码,如下(如果你需要这个源文件,请留下你的EMAIL地址): 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 
<%
'----------------------------------------------------------------------------------------
'转发时请保留此声明信息,这段声明不并会影响你的显示速度!
'************************* 随机图片显示 ****************************
'代码设计:一页书http://www.yiyeshu.org
'设计时间:2003-08-01
'使用实例:img.asp?list=图片存放目录
'使用注意:图片目录放于本文件同目录下!需要FSO支持!
'我的主页:http://www.xq2003.com/xing
'如有不明白,可以留言给我,或者到我的论坛找我
'----------------------------------------------------------------------------------------
Function AllPath()
Dim Domain,GFilePath
Domain = Request.ServerVariables("SERVER_NAME")
GFilePath = Request.ServerVariables("PATH_INFO")
GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/")))
AllPath = "http://"&Domain&GFilePath
End Function

Function ShowFileList(folderspec)
Dim Path,objFSO,objFolder,count,objFile,nume,S
Path = Server.MapPath(folderspec)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Path) Then
Set objFolder = objFSO.GetFolder(Path)
count = 0
For Each objFile in objFolder.Files
count = count+1
Next
randomize
nume = Int((count*rnd)+1)
S = 0
ShowFileList = ""
For Each objFile in objFolder.Files
S = S + 1
If S = nume Then
ShowFileList = objFile.Name
Exit For
End If
Next
Set objFolder = Nothing
Else
ShowFileList = "NO"
End If
Set objFSO = Nothing
End Function

Dim list,filename,address,str

list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=

图片存放目录"
Response.End()
end if

filename = ShowFileList("./"&list&"/")
if filename = "NO" then
Response.write "您指定的目录"&list&"不存在,请重新指定!"
Response.End()
end if

if filename = "" then
Response.write "您指定的目录"&list&"没有相关的图片文件存在,请重新指定!"
Response.End()
end if

str = right(filename,3)
if str<>"jpg" and str<>"gif" then 
filename = "erro.gif" 
end if 

address = AllPath&list&"/" 
address = address&filename 
%> 
<%Response.redirect(address)%> 


—— 






----
      
 我飞。我飞。。我飞飞飞。。。
 

     

[关闭][返回]