当前位置: 移动技术网 > IT编程>开发语言>.net > 利用AspJpeg组件实现远程图片保存

利用AspJpeg组件实现远程图片保存

2018年09月14日  | 移动技术网IT编程  | 我要评论

修神之至尊之路,巢湖租房,天山雪枭

    aspjpeg相信大家都听说过吧,可是用aspjpeg远程保存图片你会么?下面就让我们来看一下网友提供的这段代码吧:
<%
**********csdn技术区-coolbird88提供完整代码,感谢netdust提供核心代码*********

server.scripttimeout=99999
savepath="upfiles/" 图片保存路径,可以根据自己的需要,进行修改,如没有创建此文件夹,将自动创建
imgpath=request("imgpath")

if imgpath="" then
response.write "<form name=mofeiform method=post action=><input type=text name=imgpath size=35> <input type=submit name=submit001 value=上传></form><br/>在输入框中输入远程图片地址,如图片不存在,程序自动放弃本次操作."
else

str = right(imgpath,3)
if str<>"jpg" and str<>"gif" then
 response.write "文件格式不正确 [ <a href=# onclick=history.go(-1)>重新上传</a> ]"
response.end
end if

为文件重命名
randomize
rannum=int(999*rnd)
filename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum
为文件重命名结束

set mxml(标准化越来越近了)http = server.createobject("msxml(标准化越来越近了)2.xml(标准化越来越近了)http")
mxml(标准化越来越近了)http.open "get",imgpath,false
mxml(标准化越来越近了)http.send strpostdata

set jpeg1 = server.createobject("persits.jpeg")
jpeg1.openbinary(mxml(标准化越来越近了)http.responsebody)
jpeg1.width = 130
jpeg1.height = 100
jpeg1.save(server.mappath(savepath&filename&".jpg"))
set jpeg1 = nothing
end if
response.write "&nbsp;文件上传成功,请提交!"
response.end
imgurl=savepath&filename&".jpg" 此句赋值之后可以写入
%>

技术交流 永无止境

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网