1.2 图片水印缩略图,后台管理


一 修改 upload.asp

sub upload_msg(mn) 调用内找到



Code:
  case 4
    uptemp=vbcrlf&"<font class=red>上传成功</font>:<a href='"&upload_path&uppath&"/"&upfile_name&"' target=_blank>"&upfile_name&"</a> ("&upfilesize&"Byte)"


在下面填加


Code:
'----------------------------------水印修改开始----------------------------------------
    Dim Photo,Logo,PhotoPath,LogoPath,Jpeg,Path
     '头像水印修改
     if lcase(uppath)="face" then
     if lcase(upfile_name2)<>"gif" then
'创建缩微图
Set Jpeg = Server.CreateObject("Persits.Jpeg")'建立实例
Path = Server.MapPath(upload_path&uppath&"/"&upfile_name)'打开图片
Jpeg.Open Path
Jpeg.Width = 120
Jpeg.Height = 120
Jpeg.Save Server.MapPath(upload_path&uppath&"/"&upfile_name)
Set Jpeg = Nothing
  end if
  end if
     '下载水印修改
     if lcase(uppath)="down" then
'创建缩微图
Set Jpeg = Server.CreateObject("Persits.Jpeg")'建立实例
Path = Server.MapPath(upload_path&uppath&"/"&upfile_name)'打开图片
Jpeg.Open Path
Jpeg.Width = dim_num(15)
Jpeg.Height = dim_num(16)
Jpeg.Save Server.MapPath(upload_path&uppath&"/"&upfile_name)
Set Jpeg = Nothing
  end if
'如果是新闻上传或者语录上传或者其他
     if lcase(uppath)="news" or lcase(uppath)="article" or lcase(uppath)="update" then
     if lcase(upfile_name2)="jpg" then
'图片加水印  
Set Photo = Server.CreateObject("Persits.Jpeg")
PhotoPath = Server.MapPath(upload_path&uppath&"/"&upfile_name)
Photo.Open PhotoPath
Set Logo = Server.CreateObject("Persits.Jpeg")
LogoPath = Server.MapPath(dim_upload(7))
Logo.Open LogoPath
Photo.DrawImage Photo.width-dim_upload(8), Photo.height-dim_upload(9),Logo,dim_upload(10),&hFFFFFF
Photo.Save Server.MapPath(upload_path&uppath&"/"&upfile_name)
Set Photo = Nothing'注销实例
  end if
end if

'如果是论坛上传
     if lcase(uppath)="forum" then
     if lcase(upfile_name2)="jpg" then
     '图片加水印
Set Photo = Server.CreateObject("Persits.Jpeg")
PhotoPath = Server.MapPath(upload_path&uppath&"/"&upfile_name)
Photo.Open PhotoPath
Set Logo = Server.CreateObject("Persits.Jpeg")
LogoPath = Server.MapPath(dim_upload(7))
Logo.Open LogoPath
Photo.DrawImage Photo.width-dim_upload(8), Photo.height-dim_upload(9),Logo,dim_upload(10),&hFFFFFF
Photo.Save Server.MapPath(upload_path&uppath&"/"&upfile_name)
Set Photo = Nothing'注销实例
end if
end if
'如果相片上传
If lcase(uppath)="gallery" then
     if lcase(upfile_name2)="jpg" then
'创建缩微图
Set Jpeg = Server.CreateObject("Persits.Jpeg")'建立实例
Path = Server.MapPath(upload_path&uppath&"/"&upfile_name)'打开图片
Jpeg.Open Path
Jpeg.Width = dim_num(15)
Jpeg.Height = dim_num(16)
Jpeg.Save Server.MapPath(upload_path&uppath&"/"&"s"&upfile_name)
Set Jpeg = Nothing
'添写缩微图
tmpjs=tmpjs&"parent.document.all.spic.value='"&uppath&"/"&"s"&upfile_name&"';"
    uptemp=uptemp&vbcrlf&"<script language=javascript>"&vbcrlf&tmpjs&vbcrlf&"</script>"    
'加水印
Set Jpeg = Server.CreateObject("Persits.Jpeg")'建立实例
Path = Server.MapPath(upload_path&uppath&"/"&upfile_name)'打开图片
Jpeg.Open Path
Set Logo = Server.CreateObject("Persits.Jpeg")
LogoPath = Server.MapPath(dim_upload(7))
Logo.Open LogoPath
Jpeg.DrawImage Jpeg.width-dim_upload(8),Jpeg.height-dim_upload(9),Logo,dim_upload(10),&hFFFFFF
Jpeg.Save Server.MapPath(upload_path&uppath&"/"&upfile_name)
Set Jpeg = Nothing
  End If
end if
'----------------------------------水印修改结束----------------------------------------


二 修改文件 include/admin_config_edit.asp

替换sub joekoe_chk_upload() 整段


Code:
sub joekoe_chk_upload()
  dim tdown
  if chk() then
    web_down=code_config(request.form("tdown_0"),4)&"|"&code_config(request.form("tdown_1"),4)
    web_dim(13)=code_url(code_config(request.form("web_upload"),2))
    web_dim(14)=code_config(request.form("tdim_0"),2)&"|"&code_num(request.form("tdim_1"),500)&"|"&code_num(request.form("tdim_2"),5)&"|"&code_num(request.form("tdim_3"),0)&"|"& _
code_url(code_config(request.form("tdim_4"),2))&"|"&code_url(code_config(request.form("tdim_5"),2))&"|"& _
          code_config(request.form("tdim_6"),2)&"|" & _
          code_config(request.form("tdim_7"),2)&"|" & _
          code_num(request.form("tdim_8"),0)&"|" & _
          code_num(request.form("tdim_9"),0)&"|" & _
          code_num(request.form("tdim_10"),0)
    call joekoe_template_common()
    call joekoe_template_common_other()
    call joekoe_template_js_config()
    call admin_msg("已成功修改了"&ntit&tit_fir&"!","?action="&action,1)
    exit sub
  end if
  call form_first()
  tdim=split(web_dim(14),"|")
  tdown=split(web_down,"|")
%>
<form action='?action=<%response.write action%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>上传路径:</td>
<td><input type=text name=web_upload value='<% response.write web_dim(13) %>' size=20 maxlength=20></td>
<td class=gray>为防有错,尽量不要修改此项</td>
</tr>
<tr>
<td>文件类型:</td>
<td><input type=text name=tdim_0 value='<% response.write tdim(0) %>' size=35 maxlength=50></td>
<td class=gray>多个类型用“,”分开</td>
</tr>
<tr>
<td>文件大小:</td>
<td><input type=text name=tdim_1 value='<% response.write tdim(1) %>' size=20 maxlength=10> KB(千字节),最好小于500</td>
<td class=gray>上传文件大小的最大值</td>
</tr>
<tr>
<td>上传数量:</td>
<td><input type=text name=tdim_2 value='<% response.write tdim(2) %>' size=12 maxlength=10> 个     每天可上传文件的数量 = 上传数量 * 用户组系数</td>
<td class=gray></td>
</tr>
<%
tmp1=tdim(3)
if not(isnumeric(tmp1)) then tmp1=0
tmp1=int(tmp1)
%>
<tr>
<td>组件类型:</td>
<td><select name=tdim_3 size=1>
<option value='0'<%if tmp1=0 then response.write " selected"%>>无组件上传</option>
<option value='1'<%if tmp1=1 then response.write " selected"%>>LyfUpload<%if object_install("lyfupload.uploadfile")=false then response.write "(不支持)"%></option>
<option value='2'<%if tmp1=2 then response.write " selected"%>>Aspupload<%if object_install("persits.upload")=false then response.write "(不支持)"%></option>
</select></td>
<td class=gray>上传文件时的上传组件类型</td>
</tr>
<tr><td colspan=3 class=td>水印文字图片设置</td></tr>
<tr>
<td>文字水印颜色:</td>
<td><input type=text name=tdim_6 value='<% response.write tdim(6) %>' size=10 maxlength=6></td>
<td class=gray>文字水印的颜色</td>
</tr>
<tr>
<td>上传图片水印:</td>
<td><input type=text name=tdim_7 value='<% response.write tdim(7) %>' size=50 maxlength=100></td>
<td class=gray>为空将不使用图片水印</td>
</tr>
<tr>
<td>水印图片属性:</td>
<td>宽 <input type=text name=tdim_8 value='<% response.write tdim(8) %>' size=6 maxlength=3> 像素,高 <input type=text name=tdim_9 value='<% response.write tdim(9) %>' size=6 maxlength=3> 像素,透明度 <input type=text name=tdim_10 value='<% response.write tdim(10) %>' size=6 maxlength=3> %</td>
<td class=gray>增加水印时使用的图片的大小及透明度</td>
</tr>
<tr><td colspan=3 class=td>其它路径设置</td></tr>
<tr>
<td>软件目录:</td>
<td><input type=text name=tdim_4 value='<%response.write tdim(4)%>' size=20 maxlength=20></td>
<td class=gray>下载栏目的软件目录路径</td>
</tr>
<tr><td colspan=3 class=td>软件相关属性设置</td></tr>
<tr>
<td>运行环境:</td>
<td colspan=2><input type=text name=tdown_0 value='<%response.write tdown(0)%>' size=62 maxlength=200> 多个请用“:”隔开</td>
</tr>
<tr>
<td>授权类型:</td>
<td colspan=2><input type=text name=tdown_1 value='<%response.write tdown(1)%>' size=62 maxlength=200> 多个请用“:”隔开</td>
</tr>
<%
  erase tdim
  erase tdown
  call submit_config()
end sub


三 修改文件 include/commom.asp

将 web_dim(14)=""
内容更改为


Code:
web_dim(14)="gif,jpg,swf,rar,zip|100|10|0|per/|FF00FF|images/watermark.bmp|175|75|0.8"


水印说明

水印图片地址为空则不加水印

贴图栏目上传图片自动添加略缩图
下载栏目上传图片自动生成略缩图(后台设置大小)
头像上传图片自动生成略缩图(后台设置大小)

水印图片 背景色为白色 既为透明



http://www.joekoe.com/forum/view_61621.vhtml

[本日志由 cmscn 于 2009-04-13 11:38 AM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: 水印
相关日志:
评论: 0 | 引用: 0 | 查看次数: 539
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 20 字 | UBB代码 关闭 | [img]标签 关闭