水印测试(重新测试)
2018-09-06 12:26
注:如果你是用Fireworks来处理LOGO图片,在导出图片的时候用Alpha透明而不要用索引透明!
DimJpeg,Logo
SetJpeg=Server.CreateObject(Persits.Jpeg)
Jpeg.OpenServer.MapPath(UploadDir&Request2.Form(LocalImage))打开图片
添加文字水印
Jpeg.Canvas.Font.Family=Verdana
Jpeg.Canvas.Font.Size=15
Jpeg.Canvas.Font.ShadowColor=&HCCCCCC水印文字的阴影色彩。
Jpeg.Canvas.Font.ShadowXoffset=2阴影右偏移,负值则左偏移。
Jpeg.Canvas.Font.ShadowYoffset=2阴影下偏移,负值则右偏移。
Jpeg.Canvas.Font.Quality=1水印文字清晰度,从0~4
Jpeg.Canvas.Font.ShadowColor=&H999999
Jpeg.Canvas.Pen.Width=1
Jpeg.Canvas.Brush.Solid=True
Jpeg.Canvas.Font.Bold=True
Jpeg.Canvas.PrintJpeg.width-201,Jpeg.height-20,Copyright(c)GoalersBLOG
添加水印图片
SetLogo=Server.CreateObject(Persits.Jpeg)
Logo.OpenServer.MapPath(canvasLogo.gif)
IF(Jpeg.width-8>Logo.widthANDJpeg.height-8>Logo.height)THEN
Logo.Sharpen0.7,120
Jpeg.DrawImageJpeg.width-Logo.width-8,Jpeg.height-Logo.height-8,Logo,1,&HFFFFFF抽取掉白色背景,水印位于右下角
Jpeg.SaveServer.MapPath(UploadDir&Request2.Form(LocalImage))保存文件
ENDIF
SetLogo=Nothing注销对象
SetJpeg=Nothing注销对象