当前位置: 代码迷 >> ASP >> aspjpeg组件装配了,无显示水印
  详细解决方案

aspjpeg组件装配了,无显示水印

热度:101   发布时间:2012-10-31 14:37:32.0
aspjpeg组件安装了,无显示水印
aspjpeg组件安装到了服务器上,代码也写好了,但是就不显示水印,有是有就在图片会显示三个小方格,不知道是啥原因,求解中
代码如下:
VBScript code

<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
    filepath=trim(upload.form("filepath"))
    filelx=trim(upload.form("filelx"))
    
    i=0
    for each formName in upload.File
        set file=upload.File(formName)
 
 fileExt=lcase(file.FileExt)    '得到的文件扩展名不含有.
         '这里为开始判断只能加哪种类型的图片,这里限死了只能加gif,jpg,png,bmp
 fileExt=lcase(fileExt)
 if fileExt <> "gif" and fileExt <> "jpg" and  fileExt <>"png" and  fileExt <>"swf" then    
 Response.Write("<span style=""font-family: 宋体; font-size: 9pt"">您只能上传 [gif/jpg/png/swf] 类型的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>")
Response.End()
end if'判断结束


 randomize
 ranNum=int(90000*rnd)+10000
 filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
%>
<%
 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
  'file.SaveAs Server.mappath(filename)   ''保存文件
  file.SaveToFile Server.mappath(FileName)
  
  
  Set Jpeg = Server.CreateObject("Persits.Jpeg") 
Jpeg.Open Server.MapPath(""&FileName) 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
ImageWidth=280 
ImageHeight=230
'ImageWidth=Jpeg.OriginalWidth/2-35 
'ImageHeight=Jpeg.OriginalHeight-15
ImageWidth=Jpeg.OriginalWidth/2-45 
ImageHeight=Jpeg.OriginalHeight-25



Jpeg.Canvas.Font.Color = &HDADADA '颜色 
Jpeg.Canvas.Font.Family = "Arial" '字体 
Jpeg.Canvas.Font.size = "24" '大小 
Jpeg.Canvas.Font.Bold = True '是否加粗 
Jpeg.Canvas.Print ImageWidth, ImageHeight, "铺铺发" 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    
Jpeg.Save Server.MapPath(""&FileName) 
Set Jpeg = Nothing   
     response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
     Response.Write "<script language=""javascript"">window.alert(""文件上传成功!请不要修改生成的链接地址!"");window.close();</script>"
     End If
     Set File=Nothing
   Next
End If
Set Upload=Nothing
Private Function CheckFileExt(FileExt)
Dim ForumUpload,i
ForumUpload="gif,jpg,bmp,jpeg,png"
ForumUpload=Split(ForumUpload,",")
CheckFileExt=False
For i=0 to UBound(ForumUpload)
   If LCase(FileExt)=Lcase(Trim(ForumUpload(i))) Then
    CheckFileExt=True
    Exit Function
   End If
Next
End Function
Function FixName(UpFileExt)
If IsEmpty(UpFileExt) Then Exit Function
FixName = Lcase(UpFileExt)
FixName = Replace(FixName,Chr(0),"")
FixName = Replace(FixName,".","")
FixName = Replace(FixName,"asp","")
FixName = Replace(FixName,"asa","")
FixName = Replace(FixName,"aspx","")
FixName = Replace(FixName,"cer","")
FixName = Replace(FixName,"cdx","")
FixName = Replace(FixName,"htr","")
End Function
Private Function UserFaceName(FileExt)
Randomize
RanNum = Int(90000*rnd)+10000
   UserFaceName = UserID&Year(now)&Month(now)&Day(now)&Hour(now)&Minute(now)&Second(now)&RanNum&"."&FileExt
End Function
Private Function CheckFileType(FileType)
CheckFileType = False
If Left(Cstr(Lcase(Trim(FileType))),6)="image/" Then CheckFileType = True
End Function


  'response.write file.FileName&"  上传成功!  <br>"
  'response.write "新文件名:"&FileName&"<br>"
  'response.write "新文件名已复制到所需的位置,可关闭窗口!"
  'if filelx="swf" then
      'response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(file.FileSize/10240)&" K'"
  'end if
  'response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'"
%>
<%
 set file=nothing
%>