Adjust the camera, upload downloaded images, local display pictures

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.