欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

圖片自動保存到本地并利用aspjpeg為圖片加水印

 更新時間:2006年07月15日 00:00:00   作者:  
<%
'函數(shù)功能:遠(yuǎn)程圖片自動保存到本地服務(wù)器,并利用aspjpeg為圖片加上水印
'(注意:請先在目錄下創(chuàng)建images目錄,用來保存臨時圖片)
'本程序需要在服務(wù)器上安裝"aspjpeg組件"否則無法正常使用
'也可以只取'''''22222222'''''''以上的部分,這部分可以保存圖片,第二部分是進(jìn)行水印增加
'使用方法,請保存為saveimg.asp
'saveimg.asp?url=http://siyizhu.com/logo.gif 即可以取下圖片啦,HOHO. 其他需要加的功能,大家自己擴(kuò)展好啦
'如何獲取其他后綴名的文件呢? 當(dāng)然也可以啦
'(jpg|gif|png|bmp)改成(mp3)明白吧? 就是取mp3后綴的文件名.以此類推. 嘻嘻

Server.ScriptTimeOut=99999

const savepath="images" '圖片保存路徑
url=request("url")

function myreplace(str)
newstr=str
set objregEx = new RegExp
objregEx.IgnoreCase = true
objregEx.Global = true
objregEx.Pattern = "http://(.+?)\.(jpg|gif|png|bmp)" '定義文件后綴
set matches = objregEx.execute(str)
for each match in matches
newstr=replace(newstr,match.value,saveimg(match.value))
next
myreplace=newstr
end function

function saveimg(url)
temp=split(url,".")
'以下是用時間與隨機(jī)數(shù)重命名文件名
randomize
ranNum=int(90000*rnd)+10000
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&temp(ubound(temp))
'文件名重命名結(jié)束
set xmlhttp=server.createobject("Microsoft.XMLHTTP")
xmlhttp.open "get",url,false
xmlhttp.send
img=xmlhttp.ResponseBody
set xmlhttp=nothing
set objAdostream=server.createobject("ADODB.Stream")
objAdostream.Open()
objAdostream.type=1
objAdostream.Write(img)
objAdostream.SaveToFile(server.mappath(savepath&filename))
objAdostream.SetEOS
set objAdostream=nothing
'''''''222222222'''''''''''
saveimg=savepath&filename '獲取保存路徑
Dim Jpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(saveimg) '打開保存圖片的路徑

' 添加文字水印
Jpeg.Canvas.Font.Color = &HFF0000' 紅色
Jpeg.Canvas.Font.Family = "宋體"
Jpeg.Canvas.Font.Bold = True 
Jpeg.Canvas.Print Jpeg.OriginalWidth-200,Jpeg.OriginalHeight-50, "siyizhu.com" '水印離左邊的距離,離頂端的距離,這個是放在右下腳了
'保存文件
Jpeg.Save Server.MapPath(saveimg) '保存添加水印后的圖片

' 注銷對象
Set Jpeg = Nothing
end function
%>
注意你的服務(wù)器組件支持哦. 

相關(guān)文章

最新評論