Recientemente, necesito abrir el método WeChat Sharing de la aplicación a WebView, que involucra las imágenes compartidas. Si se conecta a través de la transferencia de imágenes, obtendrá el archivo de imagen nuevamente en el fondo, lo que afectará la velocidad. Elegí WebView para pasar la imagen a la aplicación local en la codificación base64 bits. Aquí está el código de referencia de implementación:
<! Doctype html> <html> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"> <title> Imagen a base64-JSFIDDLE DEMO por Handtrix </title> <script type = 'text/javascript' src = '// code.jquery.com/jquery-2.0.2.js'> </script> <link rel = "stylesheet" type = "text/css" href = "/css/result-light.css" rel = "nofollow externo"> <type de estilo = 'text/css'> @imort url ('// netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css'); cuerpo {relleno: 20px; } </style> <script type = 'text/javascript'> // <! [cdata [$ (ventana) .load (function () {/** * convertimgToBase64 * @param {string} url * @param {function} callback * @param {string} [salida = 'image/png']] * @author handtrix * @Exather convertimgTobase64 ('http://goo.gl/aoxhal', function (base64Img) {console.log ('image:', base64img);}) */function convertimtobase64 (url, callback, outputformat) {var canvas = document.createelement ('canvas'); Canvas.getContext ('2d'); 'Image/png'); convertimgTobase64 (imageUrl, function (base64Img) {$ ('. output') .find ('textArea') .val (base64Img) .end () .find ('a') .Attr ('href', base64Img) .Text (base64Img) .end () .Find ('img') .Attr ('src', 'srrc', ',' srrc ',' srrc ',' srrc ',' srrc. base64img); }); event.preventDefault (); }); }); //]]> </script> </head> <body> <h2> input </h2> <form id = "img2b64"> <input type = "url" name = "url" placeholder = "insertar una imagen-url" valor = "http://upload.wikimedia.org/wikipedia/commons/4/4a/logo_2013_google.png" requerido> <span> <input type = "enviar"> </span> </form> <hr> <h2> salida </h2> <ivic> <xtexarea> </textARea> <BRAY> <a> </a> <br> <br> <img> <br> </div> </body> </html>PD: Aquí hay una herramienta para la codificación de conversión de imágenes en línea64 para su referencia:
Conversión de imagen a la herramienta en línea de codificación de Base64 : http://tools.vevb.com/transcoding/img2base64