asp如何添加图片上传自动添加水印

我下载了些组件 比如ASPjpeg 但是不知道怎么用 已经有图片上传的代码了 但是再怎么插入aspjpeg组件呢

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="upsave.inc"-->

<%
Server.ScriptTimeOut=999999
dim formName,formPath,filename,file_name,fileExt,Filesize,F_Type

call upload()

'===========================无组件上传============================
sub upload()
dim upload,file
set upload=new UpFile_Class ''建立上传对象
upload.GetDate (1000*1024) '取得上传数据,不限大小

if upload.err > 0 then
select case upload.err
case 1
Response.Write "<table><tr><td bgcolor=#E9F5F5>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
case 2
Response.Write "<table><tr><td bgcolor=#E9F5F5>文件大小超过了限制 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
end select
exit sub
else
formPath="../../images/uploadimg/"'upload.form("filepath")
'在目录后加(/)
'if right(formPath,1)<>"/" then formPath=formPath&"/"

for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象

fileExt=lcase(file.FileExt)

'判断文件类型
if lcase(fileEXT)="asp" and lcase(fileEXT)="asa" and lcase(fileEXT)="aspx" then
CheckFileExt(fileEXT)=false
end if
if CheckFileExt(fileEXT)=false then
response.write "<table><tr><td bgcolor=#E9F5F5>文件格式不正确 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
response.end
end if

'付值变量
randomize
ranNum=int(90000*rnd)+10000
file_name=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
filename=file_name&"."&fileExt
rename=filename&"|"
filename1=formPath&filename
Filesize=file.FileSize

'记录文件
if Filesize>0 then '如果 FileSize > 0 说明有文件数据
file.SaveToFile Server.mappath(FileName1) ''执行上传文件
call ImgWriter(FileName1)'添加水印
call checksave() '记录文件
end if
set file=nothing
next
end if
set upload=nothing
response.write "<table><tr><td bgcolor=#E9F5F5>"&FileName&"上传成功![ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
end sub

'判断文件类型是否合格
Private Function CheckFileExt (fileEXT)
dim Forumupload
Forumupload=split("jpg|gif|png","|")
for i=0 to ubound(Forumupload)
if lcase(fileEXT)=lcase(trim(Forumupload(i))) then
CheckFileExt=true
exit Function
else
CheckFileExt=false
end if
next
End Function

Private sub checksave()
'插入上传表并获得ID
response.write "<script>parent.form2.N_image.value='images/uploadimg/"&FileName&"'</script>"
end Sub
Sub ImgWriter(SaveImgPath) '添加水印
dim jpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(SaveImgPath)
Jpeg.Canvas.Font.Color = &Hffffff
Jpeg.Canvas.Font.Family = "Tahoma"
Jpeg.Canvas.Font.Size = 16
Jpeg.Canvas.Font.ShadowColor = &H000000
Jpeg.Canvas.Font.ShadowXoffset = -1
Jpeg.Canvas.Font.ShadowYoffset = 1
Jpeg.Canvas.Font.Bold = true
Jpeg.Canvas.Print 10, 10, "imediacn.com"
Jpeg.Canvas.Pen.Color = &Heeeeee
Jpeg.Canvas.Pen.Width = 1
Jpeg.Canvas.Brush.Solid = False
Jpeg.Canvas.Bar 0, 0, Jpeg.Width, Jpeg.Height
Jpeg.Save Server.MapPath(SaveImgPath)
End Sub
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-12-29
<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath("images/dodge_viper.jpg")
开始写文字
Jpeg.Canvas.Font.Color = &000000' red 颜色
Jpeg.Canvas.Font.Family = "Courier New" 字体
Jpeg.Canvas.Font.Bold = True 是否加粗
Jpeg.Canvas.Print 10, 10, "Copyright (c) XYZ, Inc."
打印坐标x 打印坐标y 需要打印的字符
以下是对图片进行边框处理
Jpeg.Canvas.Pen.Color = &H000000' black 颜色
Jpeg.Canvas.Pen.Width = 2 画笔宽度
Jpeg.Canvas.Brush.Solid = False 是否加粗处理
Jpeg.Canvas.Bar 1, 1, Jpeg.Width, Jpeg.Height
起始X坐标 起始Y坐标 输入长度 输入高度
Jpeg.Save Server.MapPath("images/dodge_viper_framed.jpg") 保存
%>
第2个回答  2009-12-29
你下载了ASPJPGE的话,它软件都会带有DEMO的,,看看就有了..
第3个回答  2009-12-29
有专门的组件可以用!
相似回答
大家正在搜