相冊源碼asp
Ⅰ 網頁相冊代碼,可以自動載入文件夾內新添加的圖片的
可採用指定文件夾,自動遍歷其下圖片文件的形式解決,參考網上
網路存儲
(
網盤
)模塊源碼。
Ⅱ 圖片上傳的ASP源代碼
4個文件實現無組件上傳4個文件實現無組件上傳
嵌套式調用:
<iframe name="ad" frameborder=0 width=100% height=50 scrolling=no src=uploada.asp></iframe>
直接鏈接:uploada.asp
文件保存路徑:upload
上傳文件類型和大小自己設置
===========================================
第一個文件:inc/confing.asp(inc為文件夾名稱)
<%
Const EnableUploadFile="Yes" '是否開放文件上傳
Const MaxFileSize=200 '上傳文件大小限制
Const UpFileType="gif|jpg|bmp|png|swf|doc|txt|rar|zip" '允許的上傳文件類型
%>
===========================================
第二個文件:inc/upload.asp
dim oUpFileStream
Class upload_file
dim Form‚File‚Version
Private Sub Class_Initialize
'定義變數
dim RequestBinDate‚sStart‚bCrLf‚sInfo‚iInfoStart‚iInfoEnd‚tStream‚iStart‚oFileInfo
dim iFileSize‚sFilePath‚sFileType‚sFormvalue‚sFileName
dim iFindStart‚iFindEnd
dim iFormStart‚iFormEnd‚sFormName
'代碼開始
Version="無組件上傳類 Version 0.96"
set Form = Server.CreateObject("scripting.Dictionary")
set File = Server.CreateObject("scripting.Dictionary")
if Request.TotalBytes < 1 then Exit Sub
set tStream = Server.CreateObject("adodb.stream")
set oUpFileStream = Server.CreateObject("adodb.stream")
oUpFileStream.Type = 1
oUpFileStream.Mode = 3
oUpFileStream.Open
oUpFileStream.Write Request.BinaryRead(Request.TotalBytes)
oUpFileStream.Position=0
RequestBinDate = oUpFileStream.Read
iFormEnd = oUpFileStream.Size
bCrLf = chrB(13) & chrB(10)
'取得每個項目之間的分隔符
sStart = MidB(RequestBinDate‚1‚ InStrB(1‚RequestBinDate‚bCrLf)-1)
iStart = LenB (sStart)
iFormStart = iStart+2
'分解項目
Do
iInfoEnd = InStrB(iFormStart‚RequestBinDate‚bCrLf & bCrLf)+3
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iFormStart
oUpFileStream.CopyTo tStream‚iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sInfo = tStream.ReadText
'取得表單項目名稱
iFormStart = InStrB(iInfoEnd‚RequestBinDate‚sStart)-1
iFindStart = InStr(22‚sInfo‚"name="""‚1)+6
iFindEnd = InStr(iFindStart‚sInfo‚""""‚1)
sFormName = Mid (sinfo‚iFindStart‚iFindEnd-iFindStart)
'如果是文件
if InStr (45‚sInfo‚"filename="""‚1) > 0 then
set oFileInfo= new FileInfo
'取得文件屬性
iFindStart = InStr(iFindEnd‚sInfo‚"filename="""‚1)+10
iFindEnd = InStr(iFindStart‚sInfo‚""""‚1)
sFileName = Mid (sinfo‚iFindStart‚iFindEnd-iFindStart)
oFileInfo.FileName = GetFileName(sFileName)
oFileInfo.FilePath = GetFilePath(sFileName)
oFileInfo.FileExt = GetFileExt(sFileName)
iFindStart = InStr(iFindEnd‚sInfo‚"Content-Type: "‚1)+14
iFindEnd = InStr(iFindStart‚sInfo‚vbCr)
oFileInfo.FileType = Mid (sinfo‚iFindStart‚iFindEnd-iFindStart)
oFileInfo.FileStart = iInfoEnd
oFileInfo.FileSize = iFormStart -iInfoEnd -2
oFileInfo.FormName = sFormName
file.add sFormName‚oFileInfo
else
'如果是表單項目
tStream.Close
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iInfoEnd
oUpFileStream.CopyTo tStream‚iFormStart-iInfoEnd-2
tStream.Position = 0
tStream.Type = 2
tStream.Charset = "gb2312"
sFormvalue = tStream.ReadText
form.Add sFormName‚sFormvalue
end if
tStream.Close
iFormStart = iFormStart+iStart+2
'如果到文件尾了就退出
loop until (iFormStart+2) = iFormEnd
RequestBinDate=""
set tStream = nothing
End Sub
Private Sub Class_Terminate
'清除變數及對像
if not Request.TotalBytes<1 then
oUpFileStream.Close
set oUpFileStream =nothing
end if
Form.RemoveAll
File.RemoveAll
set Form=nothing
set File=nothing
End Sub
'取得文件路徑
Private function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = left(FullPath‚InStrRev(FullPath‚ "\"))
Else
GetFilePath = ""
End If
End function
'取得文件名
Private function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath‚InStrRev(FullPath‚ "\")+1)
Else
GetFileName = ""
End If
End function
'取得擴展名
Private function GetFileExt(FullPath)
If FullPath <> "" Then
GetFileExt = mid(FullPath‚InStrRev(FullPath‚ ".")+1)
Else
GetFileExt = ""
End If
End function
End Class
'文件屬性類
Class FileInfo
dim FormName‚FileName‚FilePath‚FileSize‚FileType‚FileStart‚FileExt
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
FileType = ""
FileExt = ""
End Sub
'保存文件方法
Public function SaveToFile(FullPath)
dim oFileStream‚ErrorChar‚i
SaveToFile=1
if trim(fullpath)="" or right(fullpath‚1)="/" then exit function
set oFileStream=CreateObject("Adodb.Stream")
oFileStream.Type=1
oFileStream.Mode=3
oFileStream.Open
oUpFileStream.position=FileStart
oUpFileStream.to oFileStream‚FileSize
oFileStream.SaveToFile FullPath‚2
oFileStream.Close
set oFileStream=nothing
SaveToFile=0
end function
End Class
%>
========================================
第三個文件:uploada.asp
<!--#include file="Inc/config.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
BODY{
BACKGROUND-COLOR: #f5feed;
font-size:9pt
}
.tx1 { height: 20px;font-size: 9pt; border: 1px solid; border-color: #000000; color: #0000FF}
-->
</style>
<link href="Manage/Inc/ManageMent.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%
if EnableUploadFile="Yes" then
%>
<form action="upfilea.asp" method="post" name="form1" enctype="multipart/form-data">
<input name="FileName" type="FILE" class="tx1" size="20">
<input type="submit" name="Submit" value="上傳" style="border:1px double rgb(88‚88‚88);font:9pt">
</form>
<%
end if
%>
</body>
</html>
============================
第四個文件:upfilea.asp
<!--#include file="Inc/config.asp"-->
<!--#include file="Inc/upload.asp"-->
<%
const upload_type=0 '上傳方法:0=無懼無組件上傳類,1=FSO上傳 2=lyfupload,3=aspupload,4=chinaaspupload
dim upload‚file‚formName‚SavePath‚filename‚fileExt
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg‚founderr
msg=""
founderr=false
EnableUpload=false
SavePath = "Upload" '存放上傳文件的目錄
if right(SavePath‚1)<>"/" then SavePath=SavePath&"/" '在目錄後加(/)
%>
<%
ComeinSTR=lcase(request.servervariables("HTTP_HOST"))
Url=split(ComeinSTR)
yourthing=Url(0)
%>
<html>
<head>
<link href="Manage/Inc/ManageMent.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
if EnableUploadFile="NO" then
response.write "系統未開放文件上傳功能"
else
select case upload_type
case 0
call upload_0() '使用化境無組件上傳類
case else
end select
end if
%>
</body>
</html>
<%
sub upload_0() '使用化境無組件上傳類
set upload=new upload_file '建立上傳對象
for each formName in upload.file '列出所有上傳了的文件
set file=upload.file(formName) '生成一個文件對象
if file.filesize<100 then
msg="請先選擇你要上傳的文件!"
founderr=true
end if
if file.filesize>(MaxFileSize*1024) then
msg="文件大小超過了限制,最大隻能上傳" & CStr(MaxFileSize) & "K的文件!"
founderr=true
end if
fileExt=lcase(file.FileExt)
Forumupload=split(UpFileType‚"|")
for i=0 to ubound(Forumupload)
if fileEXT=trim(Forumupload(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
EnableUpload=false
end if
if EnableUpload=false then
'msg="這種文件類型不允許上傳!\n\n只允許上傳這幾種文件類型:" & UpFileType
response.write"<script language=javascript>alert('這種文件類型不允許上傳!\n\n只允許上傳這幾種文件類型:" &
UpFileType & "');"
response.write"javascript:history.go(-1)</script>"
founderr=true
end if
strJS="<script language=javascript>" & vbcrlf
if founderr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
file.SaveToFile Server.mappath(FileName) '保存文件
msg="上傳文件成功!"
FileType=right(fileExt‚3)
select case FileType
case "jpg"‚"gif"‚"png"‚"bmp"
case "swf"
case else
strJS=strJS & "range.text=' 點擊瀏覽該文件';" & vbcrlf
end select
end if
strJS=strJS & "alert('" & msg & "');" & vbcrlf
strJS=strJS & "</script>"
response.write strJS
response.write "圖片上傳成功!文件路徑是 /" & filename & "<br>"
response.write "http://";; & yourthing & "/" & filename & "<br>"
set file=nothing
next
set upload=nothing
end sub
%>
Ⅲ 多層的電子相冊源代碼.html誰能給我提供啊
什麼意思啊???如果想做相冊(圖片)網站,可以到「源碼之家」看看。那裡有asp、php、jsp等很多網站源代碼程序。
Ⅳ 怎麼獲取手機里的相冊軟體的源碼
除非你是一個軟體編輯高手,否則的話,你是沒有辦法獲取到這個軟體的源碼的。因為這個東西需要很專業的人才能夠操作的了。
Ⅳ 在asp.net中,如何製作像QQ相冊那樣顯示圖片的功能
QQ相冊那樣 的?用分頁的原理吧。每次顯示你規定的幾個圖片。最好用C#的縮略圖處理技術顯示。然後點擊哪一個就顯示哪一個。不就行了。
Ⅵ 求HTML相冊代碼
嚴格來說,是不行,不過可以發源碼給你看看 <div align="center">
<form action="" method="post" enctype="multipart/form-data" name="form1">
<label>
上傳圖片:
<input name="file" type="file" size="100" maxlength="100">
</label>
</form>
</div> 你需要和資料庫連接
Ⅶ 誰能幫我編寫一個網頁相冊的代碼,我要交作業,需要製作一個自己的網頁相冊
在Dreamweaver中很容易就實現了網頁相冊。
步驟:打開軟體---「命令」---「創建網站相冊」---「輸入相關設置」
(註:要將做網頁相冊的圖片放到一個文件夾內才行)
如果要源碼,點「代碼」視圖復制即可。
希望對你有用。。
Ⅷ 我有個ASP.NET程序里需要添加個相冊功能 在網上看到有個相冊控制項和源碼 但是不知道怎麼填進去
其實這個,即使你在網上搜索了源代碼下來,也不定能夠運行或是看懂它,因為思路不一樣,但既然是Asp.Net做的,那麼應該有相應的控制項才行,不可能全是硬編碼,你在Asp.Net開發中,找找這個控制項,一般都有自帶的控制項,至於事件,你可得好好分析一下它的思路了。或是你去網上搜索一下用Asp.Net添加相冊功能的一些簡單描述,然後根據自己的思路來編碼。希望你成功。
Ⅸ 求網路相冊的源代碼
asp.net(c#)寫的 你看看 還行不
<%@ Page language="c#" Codebehind="GetThumbnail.aspx.cs" AutoEventWireup="false" Inherits="TipsTricks.Ch4.ShowSmallImage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>ShowSmallImage</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="ShowSmallImage" method="post" runat="server">
<FONT face="黑體"></FONT>
</form>
</body>
</HTML>
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
namespace TipsTricks.Ch4
{
/// <summary>
/// Summary description for ShowSmallImage.
/// </summary>
public class ShowSmallImage : System.Web.UI.Page
{
const int MaxLength=150; //最大長度�
private void Page_Load(object sender, System.EventArgs e)
{
if (Request.QueryString["filename"] != null)
{
//取得原圖
string filename=Request.QueryString["filename"];
Bitmap bmpOld= new Bitmap(Server.MapPath("images/" + filename));
//計算縮小比例
double d1;
if (bmpOld.Height>bmpOld.Width)
d1=(double)(MaxLength/(double)bmpOld.Width);
else
d1=(double)(MaxLength/(double)bmpOld.Height);
//產生縮圖
Bitmap bmpThumb= new Bitmap(bmpOld,(int)(bmpOld.Width*d1),(int)(bmpOld.Height*d1));
// 清除緩沖
Response.Clear();
//生成圖片
bmpThumb.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.End();
//釋放資源
bmpThumb.Dispose();
bmpOld.Dispose();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
Ⅹ 求相冊的源代碼,類似qq空間的
你直接用chrome打開QQ空間,
右擊,點擊審查元素。看源代碼多好。