首页
印 像 新 闻 系 统
网站首页 公告信息 编程实例 PHP函数 摄影无界 全景展示 我的作品 意见专栏
 

利用jpeg组件加图片水印函数

【2006年03月11日 18:50:27】 【阅读:次】 【字体:大 中 小 默认】 【背景:#换背景 #换背景 #换背景 #换背景 #换背景 #换背景 #换背景 默认】
 sub jpegclass(imgurl,fontsize,family,isbold,top,left,content) 调用过程名 
    
    Dim Jpeg,font_color,font_size,font_family,f_width,f_height,f_content
    建立实例
        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 
          Jpeg.Canvas.Print f_left,  f_top, f_content

            保存文件
          Jpeg.Save Server.MapPath(imgurl)

           注销对象
           Set Jpeg = Nothing
           response.write "水印成功,图片上加了&nbsp;&nbsp;"&content&""
end sub 

调用如下:call jpegclass("psg.jpg",13,"楷体",1,18,18,"你好,这是水印程序")


(『印像空间』 【本文来源:『转载』】 【作者:未知】 【录入:留印】)
限200字,剩余 字
关 键 字:
    
搜索条件: