Demand |
Mobile Web page or no refresh upload avatar |
Environment |
Mobile browser or browser (support HTML5) |
Implementation method |
Localresizeimg |
Address |
Https://github.com/think2011/LocalResizeIMG (original address) Link: http://pan.baidu.com/s/1ntNYXrb Password: 71CP (personal modified version) |
Description |
The original can only specify the fixed width of the picture, and the modified version of the original image upload |
How to use |
|
Simple description: Width is the height of the generated image, in personal modification, if the width is 1, the original
Quality is the quality of the picture
Success: After the successful generation is Base64 code, in success can be sent to server-side storage, base64 will generate two kinds: A prefix description of the image type of base64 code, can be placed directly into the IMG tag to use, Calling method: Result.base64 There is also a result.clearbase64, without description, read method: Result.clearbase64.
Server-side code:
$path = './uploads/'. Date (' Ymd '). ' /'; if (!file_exists ($path)) {mkdir ($path);} $file = $path. Time (). JPEG '; $base 64=base64_decode ($_post[' head '); File_put_contents ($file, $base 64)
Other instructions: Under Android Some can call album, File Manager and webcam, some can only call album and file Manager
iOS can call albums and cameras.
Unlimited PC-side
No matter what image you upload, it will eventually become a JPEG format.
Welcome Dabigatran: 252799167 Thank you @ nanning-Persimmon
This article is from the "Deanne Lei" blog, please be sure to keep this source http://a3147972.blog.51cto.com/2366547/1551066
Mobile Web No refresh upload image "compatible with Android iOS"