Before that partial JS-SDK authorized article realizes the sharing interface, then here summarizes how in the inside through JS to adjust the native camera, as well as uploads the download picture.
1. Configuration
Page introduction through JSSDK authorization, the incoming WX object, first configure the required interface
wx.config ({ /* debug:true ,*/ appid:appid, timestamp: Timestamp, noncestr:noncestr, signature:signature, jsapilist: [ ' Chooseimage ', //Take photos or choose an interface from your mobile album Previewimage ',//preview Image Interface ' uploadimage ',//Upload Image interface ' Downloadimage '//Download Image interface ]});
2. Adjust the photo/photo album
Put the following method inside the callback function that requires a click event
wx.chooseimage ({ 1//number, default 9 sizeType: [/// compress // Source is photo album, camera function (res) {
//Returns a list of local IDs for the selected photo, Localid can be displayed as the SRC attribute of the img tag $ ('. Driver-card img '). Prop (' src ', res.localids[0]); uploadphoto.uploadtoweixinserver (res.localids[0], ' car ') });
At this point we can see this effect, the representative of the success of the adjustment! In the successful callback of the Chooseimage method, I assign the selected photo to the SRC of the img that needs to be displayed, so that you can directly display the photos selected in the photo/photo album.
Adjust the camera, upload downloaded images, local display pictures