📄 advuploadpicture_seav.asp
字号:
window.location.href = "AdvUploadPicture.asp?id=0";
window.top.table100.style.display = "none";
window.top.document.all.uploadPicBtn0.value = "上传";
window.top.document.all.picsample_0.value = "1";
window.top.document.all.draw.value="<%=imgs%>";
window.top.document.all.picture_summ.value="<%=imgs_summ%>";
if(window.top.document.all.picture_name){
window.top.document.all.picture_name.value = "<%=imgs%>";
}
if(window.top.document.all.p_z_Z_PictureName){
window.top.document.all.p_z_Z_PictureName.value = "<%=imgs%>";
}
if(window.top.document.all.p_z_Z_TmpPictureName){
window.top.document.all.p_z_Z_TmpPictureName.value = "<%=imgs%>";
}
</script>
<%elseif id="1" then%>
<%
set fs=server.CreateObject("scripting.filesystemobject")
set upload=new upload_5xSoft ''建立上传对象
'--------将日期转化成文件名--------
formPath=newspic
aformPath=user
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
if right(aformPath,1)<>"/" then aformPath=aformPath&"/"
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=#FFF8EE> <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=#FFF8EE> <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=aformPath&session("id")&MakedownName()&"."&FileExt
'开始判断会员图片目录是否存在
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath(""&formPath&""&aformPath&"")) Then'如果存在就直接保存图片
file.SaveAs Server.mappath(formPath&thename)
Else
objFSO.CreateFolder(Server.MapPath(""&formPath&""&aformPath&""))'不存在就建一个目录
file.SaveAs Server.mappath(formPath&thename)
End If
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
imgs1=thename
else
response.write"<table width=100% border=0 cellspacing=0 cellpadding=5>"
response.write"<tr>"
response.write"<td bgcolor=#FFF8EE> <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
if add=1 then
' 建立实例
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' 打开目标图片
Jpeg.Open Server.MapPath("../../picture/"&imgs1&"")
' 添加文字水印
Jpeg.Canvas.Font.Color = &HD8D8D8' 灰色
Jpeg.Canvas.Font.Family = "黑体"
Jpeg.Canvas.Font.Bold = True
Jpeg.Canvas.Print Jpeg.Originalwidth/2-160, Jpeg.OriginalHeight/2, ""&qymc&""
Jpeg.Canvas.Font.Size = 24'//字体大小
' 保存文件
Jpeg.Save Server.MapPath("../../picture/"&imgs1&"")
' 注销对象
Set Jpeg = Nothing
'开始加图片
Set Photo = Server.CreateObject("Persits.Jpeg")
'确定要加入水印的图片路径
PhotoPath = Server.MapPath("../../picture/"&imgs1&"")
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/"&imgs1&"")
Set Photo = Nothing
end if
%>
<script>
//alert("上传图片成功")
window.top.document.all.uploadpic.style.display = "";
window.top.document.all.showpic.style.display = "";
//window.top.document.all.uploadpic.innerText = "上传图片\"成功!";
window.top.document.all.p_z_Z_Picsample.value = "Y";
//setInterval("window.close()",1000);
var random = Math.random();
window.top.document.all.uploaded1.width = "100";
window.top.document.all.uploaded1.height = "100";
window.top.document.all.uploaded1.src = "/picture/<%=imgs1%>";
window.location.href = "AdvUploadPicture.asp?id=1";
window.top.table101.style.display = "none";
window.top.document.all.uploadPicBtn1.value = "上传";
window.top.document.all.picsample_1.value = "1";
window.top.document.all.draw1.value="<%=imgs1%>";
if(window.top.document.all.picture_name){
window.top.document.all.picture_name.value = "<%=imgs1%>";
}
if(window.top.document.all.p_z_Z_PictureName){
window.top.document.all.p_z_Z_PictureName.value = "<%=imgs1%>";
}
if(window.top.document.all.p_z_Z_TmpPictureName){
window.top.document.all.p_z_Z_TmpPictureName.value = "<%=imgs1%>";
}
</script>
<%elseif id="2" then%>
<%
set fs=server.CreateObject("scripting.filesystemobject")
set upload=new upload_5xSoft ''建立上传对象
'--------将日期转化成文件名--------
formPath=newspic
aformPath=user
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"
if right(aformPath,1)<>"/" then aformPath=aformPath&"/"
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=#FFF8EE> <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=#FFF8EE> <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=aformPath&session("id")&MakedownName()&"."&FileExt
'开始判断会员图片目录是否存在
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Server.MapPath(""&formPath&""&aformPath&"")) Then'如果存在就直接保存图片
file.SaveAs Server.mappath(formPath&thename)
Else
objFSO.CreateFolder(Server.MapPath(""&formPath&""&aformPath&""))'不存在就建一个目录
file.SaveAs Server.mappath(formPath&thename)
End If
Set objFSO = Nothing '释放 FileSystemObject 对象实例内存空间
imgs2=thename
else
response.write"<table width=100% border=0 cellspacing=0 cellpadding=5>"
response.write"<tr>"
response.write"<td bgcolor=#FFF8EE> <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
if add=1 then
' 建立实例
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' 打开目标图片
Jpeg.Open Server.MapPath("../../picture/"&imgs2&"")
Jpeg.Canvas.Font.Color = &HD8D8D8' 灰色
Jpeg.Canvas.Font.Family = "黑体"
Jpeg.Canvas.Font.Bold = True
Jpeg.Canvas.Print Jpeg.Originalwidth/2-160, Jpeg.OriginalHeight/2, ""&qymc&""
Jpeg.Canvas.Font.Size = 24'//字体大小
' 保存文件
Jpeg.Save Server.MapPath("../../picture/"&imgs2&"")
' 注销对象
Set Jpeg = Nothing
'开始加图片
Set Photo = Server.CreateObject("Persits.Jpeg")
'确定要加入水印的图片路径
PhotoPath = Server.MapPath("../../picture/"&imgs2&"")
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/"&imgs2&"")
Set Photo = Nothing
end if
%>
<script>
//alert("上传图片成功")
window.top.document.all.uploadpic.style.display = "";
window.top.document.all.showpic.style.display = "";
//window.top.document.all.uploadpic.innerText = "上传图片\"成功!";
window.top.document.all.p_z_Z_Picsample.value = "Y";
//setInterval("window.close()",1000);
var random = Math.random();
window.top.document.all.uploaded2.width = "100";
window.top.document.all.uploaded2.height = "100";
window.top.document.all.uploaded2.src = "/picture/<%=imgs2%>";
window.location.href = "AdvUploadPicture.asp?id=2";
window.top.table102.style.display = "none";
window.top.document.all.uploadPicBtn2.value = "上传";
window.top.document.all.picsample_2.value = "1";
window.top.document.all.draw2.value="<%=imgs2%>";
if(window.top.document.all.picture_name){
window.top.document.all.picture_name.value = "<%=imgs2%>";
}
if(window.top.document.all.p_z_Z_PictureName){
window.top.document.all.p_z_Z_PictureName.value = "<%=imgs2%>";
}
if(window.top.document.all.p_z_Z_TmpPictureName){
window.top.document.all.p_z_Z_TmpPictureName.value = "<%=imgs2%>";
}
</script>
<%
end if
set rs=nothing
conn.close
set conn=nothing
%>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -