查看文章 |
用asp实现上传图片自动加水印功能
2008-03-10 21:08
<% sub jpegclass(imgurl,fontsize,family,isbold,top,left,content,horflip) 调用过程名 dim jpeg,font_color,font_size,font_family,f_width,f_height,f_content,f_horflip 建立实例 set jpeg = server.createobject("persits.jpeg") font_size=10 font_family="宋体" f_left= 5 f_top=5 if imgurl<>"" then jpeg.open server.mappath(imgurl)图片路径并打开它 else response.write "未找到图片路径" exit sub end if if fontsize<>"" then font_size=fontsize 字体大小 if family<>"" then font_family=family 字体 if top<>"" then f_left=left 水印离图片左边位置 if left<>"" then f_top=top 水印离图片top位置 if content="" then 水印内容 response.write "水印什么内容呢,水印不成功!" exit sub else f_content=content end if 添加文字水印 jpeg.canvas.font.color = &hff0000 红色 jpeg.canvas.font.family = font_family jpeg.canvas.font.size= font_size if isbold=1 then jpeg.canvas.font.bold = true end if if horflip = 1 then jpeg.fliph jpeg.sendbinary end if jpeg.canvas.print f_left, f_top, f_content 保存文件 jpeg.save server.mappath(imgurl) 注销对象 set jpeg = nothing response.write "水印成功,图片上加了 "&content&"" end sub call jpegclass("apple.jpg",13,"楷体",1,18,18,"你好,这是水印程序",1) %> 先下载aspjpeg组建,注册后使用 |
最近读者: