内容显示页
 
类别:ASP+VBS | 浏览(170) | 2006-10-20 13:58:00
主要用一个函数就可以解决了,如下:


'----------------------------------
'创建预览图片及打水印:call CreateView(文件的路径,要添加的水印图片文件)
'Design by Seven (See7di@Gmail.com)

Function CreateView(imagename,img,inttype)
Dim Object,objFont,Obj,LogoPath,sWidth,sHeight
sWidth = LogoPicWid'//LOGO的宽
sHeight = LogoPicHig'//LOGO的高

LogoPath = Server.MapPath(img)'//LOGO路径

Set Obj = Server.CreateObject("Persits.Jpeg")'//建立LOGO对象
Set Object = Server.CreateObject("Persits.Jpeg")'//建立原图对象
On Error resume Next
Obj.Open LogoPath'//读取LOGO
If err>0 Then
Response.Write ("对不起,获取LOGO图片文件失败!")
EXIT Function
End if
Object.Open Trim(Server.MapPath(imagename))'//读取原图
If err>0 Then
Response.Write ("对不起,获取需要处理的图片文件失败!")
EXIT Function
End if
Obj.Width = sWidth'//加入图片的原宽度
Obj.Height = sHeight'//加入图片的原高度

'\\如果原图比LOGO大
If Object.width>(Cint(Obj.Width)*2) and Object.Height>(Cint(Obj.Height)*2) Then
strDo="yes"
End if

If inttype=1 Then
Object.Canvas.Font.Color = FontColor'//文字的颜色
Object.Canvas.Font.Family = "Verdana"'//文字的字体
Object.Canvas.Font.Bold = FontBold'//是否加粗
Object.Canvas.Font.Size = FontSize'//字体大小
Object.Canvas.Print ""&Draw_X&"", ""&Draw_Y&"", ""&Draw_Info&""'//打印坐标x 打印坐标y 需要打印的字符

Object.Canvas.Pen.Color = &H333333'//背景颜色
Object.Canvas.Pen.Width = 1'//画笔宽度
Object.Canvas.Brush.Solid = FontSolid'//是否加粗处理
Object.Canvas.Bar 0, 0, Object.Width, Object.Height'//起始X坐标 起始Y坐标 输入长度 输入高度
Else
If strDo="yes" Then
Object.Canvas.Pen.Color = OutSideColor'// 边框的颜色
Object.Canvas.Pen.Width = OutSideWidth'// 边框的粗细
Object.Canvas.Brush.Solid = false'// 图片边框内是否填充颜色
Object.DrawImage ""&Draw_X&"", ""&Draw_Y&"", Obj, ""&Clarity&"", &HFFFFFF,90'// 加入图片的位置以及坐标,透明度(添加水印图片)
Object.Canvas.Bar 0, 0, Object.Width, Object.Height'// 图片边框线的位置坐标
Object.Width = Object.Width
Object.height = Object.height
Object.Sharpen 1, 120
End if
End If
Object.Save Server.MapPath(imagename)'// 生成文件
Set Obj=Nothing
Set Object=Nothing
End Function

引用本页地址:http://www.yongfa365.com/item/e9dbc28e51a680f6.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
专题(3)
 
.Net + C#(41)
 
ASP+VBS(153)
 
 
 
Linux(10)
 
 
 
web 2.0(24)
 
 
 
 
 
心程(59)
 
生活(80)
 
 
     

Power by :柳永法(yongfa365)'Blog | Model by :hibaidu | CSS by:众网友 | 京ICP备07011491号  QQ:64049027  E-mail:64049027qq.com

本空间赞助商:北京中科兴联信息技术有限公司