今天在做图片上传程序时, 同事问我能不能为图片加上我们自己的LOGO呢?
能加个相关的函数,能随时调用.
想了一下.就写了这个函数,给刚学ASP的初学者参考,
有不足的请大家指出. 谢谢
程序代码
'************************************
'函数名: CzLogo
'作用: 加图片水印
'参数:images_file 需要加水印的图片相对路径
' Logo 水印图片相对路径
'作者: 辣辣箭 jian08@126.com
'***********************************
Function CzLogo(Byval images_file,Logo)
On Error Resume Next
Dim Cz_Jpeg
Dim Cz_Logo,Cz_LogoPath
Dim imagename
imagename=Server.MapPath(images_file) '上传的图片位置
Cz_LogoPath = Server.MapPath(Logo) '水印位置
Set Cz_Logo = Server.CreateObject("Persits.Jpeg")
Cz_Logo.Open Cz_LogoPath
Cz_Logo.Width = 120
Cz_Logo.Height = 13
Set Cz_Jpeg = Server.CreateObject("Persits.Jpeg")
Cz_Jpeg.Open Trim(imagename)
If Cz_Jpeg.OriginalWidth>Cint(180) or Cz_Jpeg.Originalheight>Cint(60) Then
Cz_Jpeg.Canvas.Pen.Color = &H000000
Cz_Jpeg.Canvas.Pen.Width = 1
Cz_Jpeg.Canvas.Brush.Solid = False
Cz_Jpeg.DrawImage Cz_Jpeg.width-123, Cz_Jpeg.height-17, Cz_Logo, 1.0,&H000000
Cz_Jpeg.Canvas.Bar 0, 0, Cz_Jpeg.Width, Cz_Jpeg.Height
Cz_Jpeg.Save imagename
End If
Set Cz_Logo=Nothing
Set Cz_Jpeg = Nothing
End Function
-------------------
引用通告地址:http://blog.cuiz.net/trackback.asp?tbID=66