日期:2010-03-03 浏览次数:20779 次
<%
Dim oJpeg, sWidth, sHeight, sPosW, sPosH, sPath
sPath = Request.QueryString("p")
sWidth = Request.QueryString("w")
sHeight = Request.QueryString("h")
Set oJpeg = Server.CreateObject("Persits.Jpeg") '创建ASPJPEG对像
oJpeg.Open Server.MapPath("/photo/" & sPath) '把文件读出来
If sWidth <> "" Then oJpeg.Width = sWidth '将图片的大小设置为要求的大小
If sHeight <> "" Then oJpeg.Height = sHeight
'---水印操作开始---
oJpeg.Canvas.Font.Color = &HFFFFFF '水印字的颜色
oJpeg.Canvas.Font.Size = 12 '水印字的大小
oJpeg.Canvas.Font.Family = "arial" '水印字的字体
oJpeg.Canvas.Font.Bold = True '水印字是否加粗
sPosW = oJpeg.OriginalWidth '计算水印字的位置坐标
If sWidth <> "" Then sPosW = sWidth
sPosH = oJpeg.OriginalHeight
If sHeight <> "" Then sPosH = sHeight
oJpeg.Canvas.Print sPosW - 58, sPosH - 18, "azhi.net.cn" '写字上去
oJpeg.Canvas.Font.Family = "宋体"
oJpeg.Canvas.Print sPosW - 46, sPosH - 28, "阿智的博客"
'---水印操作结束---
oJpeg.SendBinary '输出处理后的图片
Set oJpeg = Nothing
%>