| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 751 人关注过本帖
标题:[求助]关于ASPJPEG组件添加水印文字的问题?
只看楼主 加入收藏
nealwang
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-5-13
收藏
 问题点数:0 回复次数:1 
[求助]关于ASPJPEG组件添加水印文字的问题?

我的空间安装有ASPJPEG组件,我想利用这个组件来达到上传图片和远程图片(保存到本地服务器后)打上水印文字,但是不知道怎么写,应该写在哪个文件中?上传的文件有两个,一个是EWEB的,另一个是ASP的UPLOAD。ASP.

如下:
<!--#include file="Inc/config.asp"-->

<!--#include file="Inc/upload.asp"-->
<%
const upload_type=0 '上传方法:0=无惧无组件上传类,1=FSO上传 2=lyfupload,3=aspupload,4=chinaaspupload

dim upload,file,formName,SavePath,filename,fileExt
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg,founderr
msg=""
founderr=false
EnableUpload=false
SavePath = SaveUpFilesPath '存放上传文件的目录
if right(SavePath,1)<>"/" then SavePath=SavePath&"/" '在目录后加(/)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
if EnableUploadFile="No" then
response.write "系统未开放文件上传功能"
else
if session("name")="" then
response.Write("请登录后再使用本功能!")
else
select case upload_type
case 0
call upload_0() '使用化境无组件上传类
case else
'response.write "本系统未开放插件功能"
'response.end
end select
end if
end if
%>
</body>
</html>
<%
sub upload_0() '使用化境无组件上传类
set upload=new upload_file '建立上传对象
for each formName in upload.file '列出所有上传了的文件
set file=upload.file(formName) '生成一个文件对象
if file.filesize<100 then
msg="请先选择你要上传的文件!"
founderr=true
end if
if file.filesize>(MaxFileSize*1024) then
msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
founderr=true
end if

fileExt=lcase(file.FileExt)
Forumupload=split(UpFileType,"|")
for i=0 to ubound(Forumupload)
if fileEXT=trim(Forumupload(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
EnableUpload=false
end if
if EnableUpload=false then
msg="这种文件类型不允许上传!\n\n只允许上传这几种文件类型:" & UpFileType
founderr=true
end if

strJS="<SCRIPT language=javascript>" & vbcrlf
if founderr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt

file.SaveToFile Server.mappath(FileName) '保存文件

msg="上传文件成功!"

strJS=strJS & "parent.HtmlEdit.focus();" & vbcrlf
strJS=strJS & "var range = parent.HtmlEdit.document.selection.createRange();" & vbcrlf
FileType=right(fileExt,3)
select case FileType
case "jpg","gif","png","bmp"
strJS=strJS & "range.pasteHTML('<img src=" & filename & ">');" & vbcrlf
case "swf"
strJS=strJS & "range.pasteHTML('<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0>"
strJS=strJS & "<param name=movie value=" & FileName & ">"
strJS=strJS & "<param name=quality value=high>"
strJS=strJS & "<embed src=" & FileName & " quality=high pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash>"
strJS=strJS & "</embed></object>');" & vbcrlf
case else
strJS=strJS & "range.text='[upload=" & FileType & "]" & FileName & "[/upload]';" & vbcrlf
end select
strJS=strJS & "parent.parent.myform.IncludePic.checked=true;" & vbcrlf
strJS=strJS & "parent.parent.myform.DefaultPicUrl.value='" & FileName & "';" & vbcrlf
strJS=strJS & "parent.parent.myform.DefaultPicList.options[parent.parent.myform.DefaultPicList.length] = new Option('" & filename & "','" & filename & "');" & vbcrlf
strJS=strJS & "parent.parent.myform.DefaultPicList.selectedIndex+=1;" & vbcrlf
strJS=strJS & "if(parent.parent.myform.UploadFiles.value==''){" & vbcrlf
strJS=strJS & "parent.parent.myform.UploadFiles.value+='" & filename & "';}" & vbcrlf
strJS=strJS & "else{" & vbcrlf & "parent.parent.myform.UploadFiles.value+='|'+'" & filename & "';}" & vbcrlf
end if
strJS=strJS & "alert('" & msg & "');" & vbcrlf
strJS=strJS & "history.go(-1);" & vbcrlf
strJS=strJS & "parent.HtmlEdit.focus();" & vbcrlf
strJS=strJS & "</script>"
response.write strJS
set file=nothing
next
set upload=nothing
end sub
%>

搜索更多相关主题的帖子: ASPJPEG组件 水印文字 服务器 dim file 
2007-05-13 21:12
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 

应该是加在这句之后:
file.SaveToFile Server.mappath(FileName) '保存文件

<%
' 建立实例
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' 打开目标图片
Jpeg.Open Server.MapPath("图片是相对地址")

' 添加文字水印
Jpeg.Canvas.Font.Color = &HFF0000 ' 水印颜色
Jpeg.Canvas.Font.Family = "宋体" '字体
Jpeg.Canvas.Font.Bold = true '是否粗体
Jpeg.Canvas.Font.italic = true '是否斜体
Jpeg.Canvas.Font.size = 16 '字号大小
Copyright = "Copyright (C) XXXX" '水印内容
Jpeg.Canvas.Print 5, 5, Copyright

' 保存文件
Jpeg.Save Server.MapPath("图片是相对地址")

' 注销对象
Set Jpeg = Nothing
Response.Write(Err.Description)
%>

具体的方法还是参照下ASPJPEG的使用说明


专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-05-14 08:51
快速回复:[求助]关于ASPJPEG组件添加水印文字的问题?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015730 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved