Dim Jpeg,font_color,font_size,font_family,f_width,f_height,f_content,f_Horflip '建立實例 Set Jpeg = Server.CreateObject("Persits.Jpeg") font_size=10 font_family="宋體" f_left= 5 f_top=5
if imgurl>"" then Jpeg.Open Server.MapPath(imgurl)'圖片路徑并打開它 else response.write "未找到圖片路徑" exit sub end if
if fontsize>"" then font_size=fontsize '字體大小 if family>"" then font_family=family '字體 if top>"" then f_left=left '水印離圖片左邊位置 if left>"" then f_top=top '水印離圖片top位置 if content="" then '水印內(nèi)容 response.write "水印什么內(nèi)容呢,水印不成功!" exit sub else f_content=content end if
' 添加文字水印 Jpeg.Canvas.Font.Color = hff0000 ' 紅色 Jpeg.Canvas.Font.Family = font_family jpeg.canvas.font.size= font_size if isbold=1 then Jpeg.Canvas.Font.Bold = True end if If Horflip = 1 Then Jpeg.FlipH 'Jpeg.SendBinary End If Jpeg.Canvas.Print f_left, f_top, f_content
' 保存文件 Jpeg.Save Server.MapPath(imgurl)
' 注銷對象 Set Jpeg = Nothing response.write "水印成功,圖片上加了 "content"" end sub