UEditor(ASP版)自动提交上传图片并添加水印的示例代码

分类:应用接口| 发布:佚名| 查看: | 发表时间:2014/10/25

先下载ueditor(ASP版),然后

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

//启用自动保存
, enableAutoSave: true
, autoSyncData: true//自动同步编辑器要提交的数据

找到:\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
'======================================================camnpr.com
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 = "宋体_GB2312" '字体
'Jpeg.Canvas.Font.Bold = true '是否加粗
Jpeg.Canvas.Font.Size = 16 '字体大小
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-220,Jpeg.OriginalHeight-30,"布布在线 WWW.BUBUOL.COM" '水印位置及文字
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
'======================================================end camnpr.com
rsState = "SUCCESS"
End Function
365据说看到好文章不转的人,服务器容易宕机
原创文章如转载,请注明:转载自郑州网建-前端开发 http://camnpr.com/
本文链接:http://camnpr.com/api/1687.html