📄 advuploadpicture_seav.asp
字号:
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include FILE="../../inc/upload_5xsoft.inc"-->
<%
if Request.Cookies("globalec")("globalecmaster")="" or Request.Cookies("globalec")("masterflag")="" then
response.write "<script language='javascript'>"
response.write"this.location.href='../login.asp';</SCRIPT>"
response.end
end if
if instr(Request.Cookies("globalec")("masterflag"),"51")=0 then
response.redirect "../err.asp"
response.end
end if
Response.Buffer = true
Response.ExpiresAbsolute=now()-1
Response.Expires=0
Response.CacheControl="no-cache"
%>
<%
if Not ChkPost then
response.redirect ("../../login/chklogin.asp?login=4")
response.end
end if
%>
<%
Dim Jpeg
dim photo,logo,photopath,logopath
dim id
id=request("id")%>
<html>
<head>
<title>
<%=webname%>_上传图片
</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type=text/css>
<!--
td {font-size: 12px;font-family: "宋体";}
A:link{ color:#039; text-decoration: underline;}
A:visited{color:#039;text-decoration: underline;}
A:hover{color:#f60;text-decoration: underline;}
.left:link { text-decoration: none; color: #000000;font-size: 14.8px}
.left:visited { color: #111111;text-decoration: none;font-size: 14.8px }
.left:hover { text-decoration: underline; color:#FF6701;font-size: 14.8px}
.left1:link {text-decoration: none;color: #ff6600;font-size: 14.8px;font-weight: bold;}
.left1:visited {color: #ff6600; text-decoration: none; font-size: 14.8px; font-weight: bold;}
.left1:hover { text-decoration: underline; color:#ff6600; font-size: 14.8px; font-weight: bold;}
.top:link { text-decoration: none; color: #0066cc;font-size: 12px;}
.top:visited { color: #0066cc;text-decoration: none;font-size: 12px ;}
.top:hover { text-decoration: underline; color:#ff6600;font-size: 12px;}
.top1:link {text-decoration: none;color: #000000;font-size: 12px;}
.top1:visited {color: #000000; text-decoration: none; font-size: 12px;}
.top1:hover { text-decoration: underline; color:#ff6600; font-size: 12px;}
.leftnav {background-color: E6E6E6;text-align:right; padding:6px 10px 6px 0px;cursor:hand;}
.leftnav1 {background-color: ffffff;text-align:right; padding:6px 10px 6px 0px;}
.leftnav2 {background-color: f2f2f2;text-align:right; padding:6px 10px 6px 0px;cursor:hand;}
.topnav {background-color: ccffff;text-align:center;}
.topnav1 {background-color: ffffff;text-align:center;}
.note {color:#999999;}
.homebg {background-repeat: no-repeat;background-position: right bottom;}
.bdr1 { border-color: #EDEDED; border-style: solid; border-top-width: 5px; border-right-width: 5px; border-bottom-width: 5px; border-left-width: 5px; padding: 0px 0px 0px 0px;}
.bdr2 { border-color: #CCCCCC; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; padding: 12px 12px 12px 12px;}
.bdr3 { border-color: #CC6633; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; padding: 12px 12px 12px 12px;}
.tbg1 {background-color: CC6633;font-size: 14.8px;color:#ffffff; padding: 4px 4px 4px 4px;font-weight: bold;}
.tbg2 {background-color: FFF7D8;font-size: 12px;color:#000000; padding: 4px 4px 4px 4px;}
.tbg3 {background-color: CC6633;font-size: 16px;color:#ffffff; padding: 4px 4px 4px 4px;font-weight: bold;}
.fbg1 { border-color: #FFCC99; border-style: solid; border-top-width: 2px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding: 4px 4px 4px 4px;background-color: #F1EEEE;color:#CC3300;font-weight: bold;}
.formtop {text-align:right;vertical-align:top;padding-top:6px}
.X{font-size:24px;font-weight:bold;}
.L{font-size:16px;font-weight:bold;}
.M{font:bold 14.8px 宋体}
.C{font-size:14.8px}
.S{font-size:12px;}
.lh13{line-height:130%}
.lh17{line-height:170%}
.padded { padding: 12px 12px 12px 12px;}
.temp {color: #999999;}
.rd14 {font-size: 14px; font-weight: bold; color: #cc0000; }
.sg {color: #666666}
.pj1x {color: #006600; font-weight: bold; font-size: 12px; }
.pj2x {font-size: 12px; font-weight: bold; }
.pj3x {font-size: 12px; font-weight: bold; color: #FF0000; }
.pj1 {color: #006600; font-weight: bold; font-size: 14px; }
.pj2 {font-size: 14px; font-weight: bold; }
.pj3 {font-size: 14px; font-weight: bold; color: #FF0000; }
/*以下是新的样式*/
.linkstyle1:link { text-decoration: underline; color: #FFFFFF;font-size: 12px}
.linkstyle1:visited { color: #FFFFFF;text-decoration: underline;font-size: 12px }
.linkstyle1:hover { text-decoration: underline; color:#FF6600;font-size: 12px}
.linkstyle2:link { text-decoration: underline; color: #000000;font-size: 14.8px}
.linkstyle2:visited { color: #000000;text-decoration: underline;font-size: 14.8px }
.linkstyle2:hover { text-decoration: underline; color:#FF6600;font-size: 14.8px}
.linkstyle3:link {text-decoration: underline;color: #ff6600;font-size: 14.8px;font-weight: bold;}
.linkstyle3:visited {color: #ff6600; text-decoration: underline; font-size: 14.8px; font-weight: bold;}
.linkstyle3:hover { text-decoration: underline; color:#ff6600; font-size: 14.8px; font-weight: bold;}
.font_13_white {font-size: 13px;font-family: "宋体";color:#FFFFFF;}
.index_title {font-size: 14.8px;font-family: "宋体";color:#000000;padding-top:2px;font-weight:bold;}
.index_content {font-size: 14.8px;font-family: "宋体";color:#000000;line-height:150%}
.content_border {border-style:solid;border-width: 0px 1px 1px 1px;border-color:000000 BDD7F7 BDD7F7 BDD7F7}
.subbutton {font-size:14px;cursor:hand;line-height:19px}
.nobianbuttonborder {border-top:#FFFFFF 5 solid;background: #F1F1F1;border-bottom:#cccccc 1 solid;text-align:center;font-size: 12px;font:bold;height:25px;}
.outborder {
BORDER-RIGHT: #999999 1px solid; BORDER-TOP: #999999 1px solid; BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #999999 1px solid
}
.red {
FONT-WEIGHT: bold; COLOR: #cc3300
}
.red:link {
COLOR: #cc3300
}
.red:visited {
COLOR: #cc3300
}
.red:hover {
COLOR: #f60
}
.lh15 {
LINE-HEIGHT: 150%
}
.lh13 {
LINE-HEIGHT: 130%
}
.lh18 {
font-size: 14px;
line-height: 150%;
}
--></STYLE>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</SCRIPT>
<%if id="0" then%>
<%
set fs=server.CreateObject("scripting.filesystemobject")
set upload=new upload_5xSoft ''建立上传对象
'--------将日期转化成文件名--------
formPath=newspic
set file=upload.file("picture") ''生成一个文件对象
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
if file.filesize>200000 then
response.write"<table width=100% border=0 cellspacing=0 cellpadding=5>"
response.write"<tr>"
response.write"<td bgcolor=#FFFFDE> <H3> 发现以下错误,无法完成请求:</H3>"
response.write"<p></p>"
response.write"<p>"
response.write"<font color=#FF0000>"
response.write"<li>上传图片大于规定(200K),请改变文件大小后重新上传</font>"
response.write"<p></p>"
response.write"<p> 请点<a href=javascript:history.back();>这里</a>返回上页重新填写。<br>"
response.write"<br>"
response.write"<br>"
response.write"<br> </td>"
response.write"</tr>"
response.write"</table>"
response.end
end if
FileExt = Mid(file.Filename, InStrRev(file.Filename, ".")+1)
FileExt = FixName(FileExt)
If Not ( CheckFileExt(FileExt) and CheckFileType(File.FileType) ) Then
'if trim(right(file.FileName,3))<>"jpg" and trim(right(file.FileName,3))<>"gif" then
response.write"<table width=100% border=0 cellspacing=0 cellpadding=5>"
response.write"<tr>"
response.write"<td bgcolor=#FFFFDE> <H3> 发现以下错误,无法完成请求:</H3>"
response.write"<p></p>"
response.write"<p>"
response.write"<font color=#FF0000>"
response.write"<li>上传图片只支持 gif|jpg|jpeg|bmp|png 图象文件</font>"
response.write"<p></p>"
response.write"<p> 请点<a href=javascript:history.back();>这里</a>返回上页重新填写。<br>"
response.write"<br>"
response.write"<br>"
response.write"<br> </td>"
response.write"</tr>"
response.write"</table>"
response.end
end if
thename=session("id")&MakedownName()&"."&FileExt
file2=server.MapPath(file2)
if fs.FileExists(file2) then
fs.DeleteFile file2,true
end if
'thename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&right(file.filename,4)
'file.filename=thename
file.SaveAs Server.mappath(formPath&thename)
imgs=thename
Set Jpeg = Server.CreateObject("Persits.Jpeg")
thename_summ=formPath_summ&session("id")&MakedownName()&".summ."&FileExt
Jpeg.Open Server.MapPath(formPath&thename)
oldw = Jpeg.OriginalWidth
oldh = Jpeg.OriginalHeight
if oldw>oldh then
Jpeg.Width = 64
Jpeg.Height = oldh/oldw*64
else
Jpeg.Height = 64
Jpeg.Width = oldw/oldh*64
end if
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath(""&formPath&""&formPath_summ&"")) Then'如果存在就直接保存图片
Jpeg.Save Server.MapPath(formPath&thename_summ)
Else
objFSO.CreateFolder(Server.MapPath(""&formPath&""&formPath_summ&""))'不存在就建一个目录
Jpeg.Save Server.MapPath(formPath&thename_summ)
End If
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
Set Jpeg = Nothing
imgs_summ=thename_summ
else
response.write"<table width=100% border=0 cellspacing=0 cellpadding=5>"
response.write"<tr>"
response.write"<td bgcolor=#FFFFDE> <H3> 发现以下错误,无法完成请求:</H3>"
response.write"<p></p>"
response.write"<p>"
response.write"<font color=#FF0000>"
response.write"<li>上传图片为空或图片太大</font>"
response.write"<p></p>"
response.write"<p> 请点<a href=javascript:history.back();>这里</a>返回上页重新填写。<br>"
response.write"<br>"
response.write"<br>"
response.write"<br> </td>"
response.write"</tr>"
response.write"</table>"
response.end
end if
'开始加图片
Set Photo = Server.CreateObject("Persits.Jpeg")
'确定要加入水印的图片路径
PhotoPath = Server.MapPath("../../picture/"&imgs&"")
Photo.Open PhotoPath
'打开水印图片
Set Logo = Server.CreateObject("Persits.Jpeg")
LogoPath = Server.MapPath("\image") & "\WaterMap.gif" '在这里修改水印图片所在的路径
Logo.Open LogoPath
' 重新定义水印图片的大小
Logo.Width = 187 '更改水印图片的宽度
Logo.Height = 50
Transition_Color = &h0066cc
'将水印放置于上传图片中
Photo.DrawImage photo.width-207, photo.height-59, Logo,1,Transition_Color,90
'在这里可以更改水印所在的位置(photo.width-210,photo.height-40 这里我是放在了图片的右下角)还可以更改水印的透明度
'保存增加水印后的图片
photo.Save Server.MapPath("../../picture/"&imgs&"")
Set Photo = Nothing
%>
<script>
//alert("上传图片成功")
window.top.document.all.uploadpic.style.display = "";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -