Mobile Web No refresh upload image "compatible with Android iOS"

Source: Internet
Author: User


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"

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.