Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何不下载图片,通过mediaId获取图片存储的URL #89

Closed
caolixiang opened this issue Sep 3, 2015 · 6 comments
Closed

如何不下载图片,通过mediaId获取图片存储的URL #89

caolixiang opened this issue Sep 3, 2015 · 6 comments

Comments

@caolixiang
Copy link

大大,我想通过mediaId拿到图片然后存在七牛云上。
看了一下API,文件被file_put_contents了,有木有接口可以直接获取URL。

@overtrue
Copy link
Collaborator

overtrue commented Sep 3, 2015

你存到本地再上传到七牛啊,url又不能直接上传到七牛

@caolixiang
Copy link
Author

http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html,是可以的。
我觉得返回一个base64对象也可以,写到本地觉得有点麻烦,还有通用性也不好。

@overtrue
Copy link
Collaborator

overtrue commented Sep 3, 2015

@caolixiang 2.x 系列已经不会改了,你最好是直接上传本地文件,上传完后可以删除

@overtrue overtrue closed this as completed Sep 3, 2015
@tanshiqi
Copy link

我也建议加上个查看media地址的方法,七牛的fetch可以直接抓取,不需要在本地绕一圈了,目前自己拼接也不麻烦,Media::API_TEMPORARY_GET +access_token +mediaId 就可以了

@overtrue
Copy link
Collaborator

@tanshiqi

  1. 我有获取素材列表的接口,你可以从列表得到mediaid
  2. 永久素材,只有视频接口给了链接,其它类型素材直接给的是内容,我哪儿来MediaId给你?http://mp.weixin.qq.com/wiki/4/b3546879f07623cb30df9ca0e420a5d0.html
  3. 临时素材也只是直直接返回素材内容http://mp.weixin.qq.com/wiki/11/07b6b76a6b6e8848e855a435d5e34a5f.html

@tanshiqi
Copy link

mediaid已经能获取到,其实楼主想要的返回的地址就是素材内容的url:https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID,而不是直接下载,比如 $media->getDownloadUrl , 这样这个url地址就可以直接给到七牛的fetch接口那里,直接传到七牛空间上去了,目前Media方法里只有download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants