国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

把文章內容中涉及到的圖片自動保存到本地服務器

2019-11-18 19:33:19
字體:
來源:轉載
供稿:網友

<%
const savepath="tempfile/"

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,".")
randomize
ranNum=int(90000*rnd)+10000
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&temp(ubound(temp))
set xmlhttp=server.createobject("Microsoft.xmlhttp")
xmlhttp.open "get",url,false
xmlhttp.send
if xmlhttp.status<>200 then
 saveimg=""
else
 img=xmlhttp.ResponseBody
 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
 saveimg=savepath&filename
end if
set xmlhttp=nothing
end function
%>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永丰县| 大新县| 江山市| 哈尔滨市| 盈江县| 沾化县| 厦门市| 仁化县| 河源市| 绍兴县| 二连浩特市| 水城县| 四子王旗| 绵阳市| 安仁县| 开化县| 都江堰市| 石渠县| 武安市| 冀州市| 盐城市| 垫江县| 巴马| 玉树县| 湟中县| 壤塘县| 大埔区| 博野县| 柳河县| 错那县| 昔阳县| 蒲江县| 吉首市| 东乌珠穆沁旗| 砀山县| 平昌县| 兴仁县| 开封县| 金堂县| 崇文区| 荆门市|