android ftp与http,按键安卓版网络访问之 图片处理,FTP,HTTP 实现

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

必备工具:

1.海草同步器 下载地址: http://pan.baidu.com/s/1c0nLwi8

2.修改版 File.lua : http://pan.baidu.com/s/1o69fE1G

按键精灵代码:

//Http获取HTTP请求

Function HttpGet(url)

Dim sTime,rpath,requestPath

sTime = Time()

requestPath = "/mnt/sdcard/sweadsync/"

rpath = requestPath & "request.txt"

File.Write rpath, url

Do

Delay (1000)

If File.Exist(rpath) = False Then

HttpGet = File.Read(requestPath & "response.txt")

Exit Function

End If

Loop While (Time() - sTime) < 30

HttpGet = ""

End Function

//Ftp获取文件

Function FtpGet(remotepath,localpath,user,pass)

Dim sTime,rpath,requestPath

sTime = Time()

requestPath = "/mnt/sdcard/sweadsync/"

rpath = requestPath & "ftpget.txt"

File.Write rpath, remotepath & "," & localpath & "," & user & "," & pass

Do

Delay (1000)

If File.Exist(rpath) = False Then

FtpGet = File.Read(requestPath & "ftpgetResult.txt")

Exit Function

End If

Loop While (Time() - sTime) < 30

FtpGet = ""

End Function

//Ftp上传文件

Function FtpPut(remotepath,localpath,user,pass)

Dim sTime,rpath,requestPath

sTime = Time()

requestPath = "/mnt/sdcard/sweadsync/"

rpath = requestPath & "ftpput.txt"

File.Write rpath, remotepath & "," & localpath & "," & user & "," & pass

Do

Delay (1000)

If File.Exist(rpath) = False Then

FtpPut = File.Read(requestPath & "ftpputResult.txt")

Exit Function

End If

Loop While (Time() - sTime) < 30

FtpPut = ""

End Function

//处理不同分辨率是图片比较必用

Function ImageOpt(src,newsrc,rotate,scale) //本地链接地址,生成后的图片链接,旋转角度,图片放大缩小值

Dim sTime,rpath

sTime = Time()

rpath = requestPath & "imageopt.txt"

Call File.Write(rpath, src & "," & newsrc & "," & rotate & "," & scale)

Do

Delay (1000)

If File.Exist(rpath) = False Then

ImageOpt= newsrc

Exit Function

End If

Loop While (Time() - sTime) < 30

ImageOpt = ""

End Function

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值