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