首页 > CMS > 新云NewAsp > 正文

新云3.1采集图片每张加上水印|新云CMS

2024-07-09 22:56:03
字体:
来源:转载
供稿:网友
打开 admin_ArticleGather.asp
在页面的End Function处添加一段函数(随便哪个End Function后面,添加以下代码)

Function Newshuiyin(syname)
  DIM PreviewSetting 
  PreviewSetting = Split(Newasp.PreviewSetting, ",")
   If UBound(PreviewSetting) < 15 Then
    PreviewSetting = Split("999,1,2,110,90,www.newasp.cn,12,#FF0000,Arial,0,images/WaterMap.gif,
0.8,#0066FF,100,35,0", ",")
   End If
   if  CInt(PreviewSetting(2)) = 0 Then exit function  '关闭水印退出
    dim Jpeg 
   dim Draw_X,Draw_Y
   dim Draw_ImageWidth
   dim Draw_ImageHeight
   dim Photo
   dim PhotoPath,Draw_Graph
   dim Logo
   dim LogoPath,DrawGraph,Transition_Color
   ' 建立图片对象
   Set Jpeg = Server.createObject("Persits.Jpeg") 
   ' 图片位置
   PhotoPath = syname 
   ' 打开图片
   Jpeg.Open PhotoPath 
    Draw_X = DrawImage_X(Jpeg.OriginalWidth,Draw_ImageWidth,2,CInt(PreviewSetting(15)))
       Draw_Y = DrawImage_y(Jpeg.Originalheight,Draw_ImageHeight,2,CInt(PreviewSetting(15)))
   ' 建立LOGO对象
   Set Logo = Server.createObject("Persits.Jpeg") 
   ' LOGO位置 
   LogoPath = Server.MapPath("/") & "/images/WaterMap.gif"  
   
   ' 打开LOGO
   Logo.Open LogoPath  
   ' 设置LOGO大小
   Logo.Width =Trim(PreviewSetting(13))
   Logo.Height = Trim(PreviewSetting(14)) 
   ' 设置图片水印位置,LOGO 透明度,抽取 LOGO 背景颜色(白色),并删除 
   'Draw_X, Draw_Y, Logobox, Draw_Graph,Transition_Color,90 '// 加入图片的
位置价坐标(添加水印图片)
   Jpeg.DrawImage   Jpeg.OriginalWidth /4 , Jpeg.OriginalHeight-25, Logo,30
   'Jpeg.DrawImage Draw_X,Draw_Y, Logo, Draw_Graph,Transition_Color,90
      ' 保存文件
   Jpeg.Save syname  
    ' 注销对象
   Set Jpeg=nothing 
 End Function
Function SlT(sltname)    'modify by  qq 850268891 
   Dim Rndname
   dim Rndname2
  DIM PreviewSetting 
   PreviewSetting = Split(Newasp.PreviewSetting, ",")
   If UBound(PreviewSetting) < 15 Then
    PreviewSetting = Split("999,1,2,110,90,www.newasp.cn,12,#FF0000,Arial,0,images/WaterMap.gif,
0.8,#0066FF,100,35,0", ",")
   End If
   If Len(NewAsp.BokeccUnion(2)) < 5 Then NewAsp.BokeccUnion(2) = "plugin.swf"
   
  dim jpeg,ranNum
  Set Jpeg = Server.CreateObject("Persits.Jpeg")    
  Jpeg.Open sltname  
  Jpeg.Width = Trim(PreviewSetting(3))   
  Jpeg.Height = Trim(PreviewSetting(4))
  randomize 
  ranNum=int(999*rnd) 
  Rndname2=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum &".jpg"
  Rndname=Server.MapPath("/article/uploadsmall") & "/" & Rndname2
  Jpeg.Save Rndname 
  SlT= "uploadsmall" & "/" & Rndname2
  set Jpeg=nothing
 End Function

查找到下面语句的位置

strFileExt = LCase(Mynewasp.GetFileExtName(FileNameArray(i)))

然后增加以下内容

If strFileExt = "gif" Then
       NewsImageUrl = FileNameArray(i)
       NewsImageUrl = SlT(Server.MapPath("/article/" & NewsImageUrl)) 
       Exit For
      End If
      If strFileExt = "jpg" Then
       NewsImageUrl = FileNameArray(i) 
       NewsImageUrl = SlT(Server.MapPath("/article/" & NewsImageUrl)) 
       Exit For
      End If
      If strFileExt = "png" Then
       NewsImageUrl = FileNameArray(i)
       NewsImageUrl = SlT(Server.MapPath("/article/" & NewsImageUrl)) 
       Exit For
      End If
      If strFileExt = "bmp" Then
       NewsImageUrl = FileNameArray(i)
       NewsImageUrl = SlT(Server.MapPath("/article/" & NewsImageUrl)) 
       Exit For
      End If

 保存,进入基本设置 水印选项 (选 ASPJPEG组件,如果不支持该组件,就不能添加水印)
上传水印图片,及设置大小,位置
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表