H5 Mobile Terminal development problems and solutions

Source: Internet
Author: User

iOS vertical screen photo Upload, picture is rotated problem

1. Get the direction of the picture via the third-party plugin Exif-js
2.new a FileReader object, loading read uploaded pictures
3. In the onload function of FileReader, the resulting picture file is received with an image object
4. In the onload function of image, use the direction obtained in step 1 to orientation, redraw a new picture with canvas rotation correction
Note the iphone has 3 camera directions to handle, horizontal screen shot, home key on the left, vertical screen shot, home built up and down
5. Turn the drawing's new diagram into a Blob object, add it to the Formdata object, and then perform the post-correction upload operation

Iphonex adaptation

1.viewport meta tag add attribute Viewport-fit=cover
<meta name= "viewport" content= "Width=device-width, Viewport-fit=cover, xxxx" >
2.body element Add Style
Body {
Padding-bottom:constant (Safe-area-inset-bottom);
Padding-bottom:env (Safe-area-inset-bottom);
}
3. If there is a fixed bottom element, also add the above style
XXX {
Padding-bottom:constant (Safe-area-inset-bottom);
Padding-bottom:env (Safe-area-inset-bottom);
Background-color: #fff; Remember to add background-color, otherwise there will be a transparent skeleton case
}

H5 Mobile Terminal development problems and solutions

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.