The image uploaded in WeChat obtains wxlocalresource://498448450243964 and is stored in the database but cannot be displayed on the front end.

WBOY
Release: 2016-10-19 10:40:57
Original
3350 people have browsed it

Upload the image in WeChat and get wxlocalresource://498448450243964. The image is stored in the database and cannot be displayed on the front end. How to solve it

Reply content:

Upload the image in WeChat and get wxlocalresource://498448450243964. The image is stored in the database and cannot be displayed on the front end. How to solve it

This is a temporary local address. You need to obtain the file content after pulling the material on the server side and return the http address to the front end.

You should be using the picture interface of WeChat JSSDK
wxlocalresource://498448450243964 This is a photo local ID list that can only be used in the client’s own WeChat browser

You also need to use the image upload interface to upload images to the WeChat server:

<code>wx.uploadImage({
    localId: 'wxlocalresource://498448450243964', // 需要上传的图片的本地ID,由chooseImage接口获得
    isShowProgressTips: 1, // 默认为1,显示进度提示
    success: function (res) {
        var serverId = res.serverId; // 返回图片的服务器端ID
    }
});</code>
Copy after login

After uploading, this picture can only be saved on the WeChat server for 3 days, so you need to use the get material interface on the backend to save the picture to your own server

http request method: GET, https call
https://api.weixin.qq.com/cgi...
Request example (the example is to obtain multimedia files through the curl command)
curl -I -G "https:/ /api.weixin.qq.com/cgi-bin/media/get?>access_token=ACCESS_TOKEN&media_id=MEDIA_ID"

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template