把文章内容中涉及到的图片自动保存到本地服务器
来源:互联网 发布:淘宝服装店铺推荐 编辑:程序博客网 时间:2024/06/15 02:27
<%
'函数功能:把文章内容中涉及到的图片自动保存到本地服务器。(注意:请先在目录下创建tempfile目录,用来保存临时图片)
'作者:小灰
'QQ:103895
'主页:http://asp2004.net
'2004.9.13
'转载或使用请不要删除上面这些信息。谢谢!
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
%>
- 把文章内容中涉及到的图片自动保存到本地服务器
- 把文章内容中涉及到的图片自动保存到本地服务器
- asp把文章内容中涉及到的图片自动保存到本地服务器
- 图片自动保存到本地服务器
- 远程图片自动保存到本地服务器
- ASP 远程图片自动保存到本地服务器
- 把页面上的图片保存到本地
- 如何从服务器的图片保存到本地
- html5 保存图片到服务器本地
- 二进图片保存到本地或服务器
- 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- >+ 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- 用asp自动解析网页中的图片地址,并将其保存到本地服务器
- 保存本地的一张图片到sd卡中
- 深入ADO内部调试
- 在父级窗口取得网页对话框中元素的值
- Asp.net中基于Forms验证的角色验证授权
- 穷男人“买”得起爱情吗
- Create Snazzy Web Charts and Graphics On the Fly with the .NET Framework
- 把文章内容中涉及到的图片自动保存到本地服务器
- J2EE设计模式学习笔记之--实际的数据存取
- java报表工具
- 哈佛成功金句
- 逼良为娼!
- 成功人士的七种精神锻炼方式 -- 像成功人士那样思考 (2)
- .NET工具
- [文]《呐喊》自序
- UserLinux 推出第一个Beta 产品(图文)