asp Ueditor增加图片水印

1、找到:ueditor\ueditor.config.js文件:

//启用自动保存

enableAutoSave: true

autoSyncData: true//自动同步编辑器要提交的数据

2、找到:\ueditor\asp\Uploader.Class.asp 文件,修改为:

Private Function DoUpload( stream, filename )

rsFileSize = stream.Size

If rsFileSize > cfgMaxSize Then

rsState = stateString.Item( "SIZE_LIMIT_EXCCEED" )

Exit Function

End If

rsOriginalFileName = filename

fileType = GetExt(filename)

If CheckExt(fileType) = False Then

rsState = stateString.Item( "TYPE_NOW_ALLOW" )

Exit Function

End If

Set formatter = new PathFormatter

rsFilePath = formatter.format( cfgPathFormat, filename )

savePath = Server.MapPath(rsFilePath)

CheckOrCreatePath( GetDirectoryName(savePath) )

stream.SaveToFile savePath

stream.Close

'======================================================

Dim Jpeg

Set Jpeg = Server.CreateObject("Persits.Jpeg")

Jpeg.Open savePath ' 图片所在位置

Dim aa

aa=Jpeg.Binary '将原始数据赋给aa

'=========加文字水印=================

Jpeg.Canvas.Font.Color = &Hccccccc '水印文字颜色 @camnpr

Jpeg.Canvas.Font.Family = "microsoft yahei" '字体

'Jpeg.Canvas.Font.Bold = true '是否加粗

Jpeg.Canvas.Font.Size = 50 '字体大小

Jpeg.Canvas.Font.ShadowColor = &H000000 '阴影色彩

Jpeg.Canvas.Font.ShadowYOffset = 1

Jpeg.Canvas.Font.ShadowXOffset = 1

Jpeg.Canvas.Brush.Solid = True

Jpeg.Canvas.Font.Quality = 4 '输出质量

Jpeg.Canvas.Print Jpeg.OriginalWidth-560,Jpeg.OriginalHeight-80,"水印名称" '水印位置及文字

bb=Jpeg.Binary '将文字水印处理后的值赋给bb,这时,文字水印没有不透明度

'============调整文字透明度================

dim MyJpeg

Dim Logo

dim bb

Set MyJpeg = Server.CreateObject("Persits.Jpeg")

MyJpeg.OpenBinary aa

Set Logo = Server.CreateObject("Persits.Jpeg")

Logo.OpenBinary bb

MyJpeg.DrawImage 0,0, Logo, 0.4 '0.4是透明度 @camnpr

MyJpeg.Save savePath ' 保存文件

set aa=nothing

set bb=nothing

Jpeg.close

MyJpeg.Close

Logo.Close

'======================================================

rsState = "SUCCESS"

End Function

你可能感兴趣的:(asp Ueditor增加图片水印)