Recently writing interface ———— about image upload
The foreground uses the Vuejs, uses the base64 to upload the picture, filedata: "Data:image/jpeg;base64,9j/4aaqsk ...", puts this data directly in the address bar, also can display the picture, But
One, base64 picture codecBasic flow: Download a picture from the network. Then base64 encoding, and then base64 decoding, stored in the local e-packing folder.
One, base64 picture codecBasic process: Download a picture from the network, then Base64 encoding, and then base64 decoding, stored in the local e-packing directory.
Java implements converting image to base64 string java implements converting base64 string to image, javabase64
Java image to base64 string, base64 string to image, the specific content is as follows
1. Convert the image to a base64 string:
/***
How to use:
The following IMG is taken over by Base64 encoded pictures
To store this picture.String img=request.getparameter ("img");System.out.print (img+ "= =");Typeconverter.generateimage (IMG);
public class TypeConverter {//Picture into Base64
Java has always lacked the BASE64 encoding API, which is often used by third-party API implementations in project development. However, Java 8 implements the BASE64 codec API, which contains the Java.util package. I'm going to do an introduction to
Java8 BASE64 Codec Java has always lacked the BASE64 encoding API, which is often used by third-party API implementations in project development. However, Java 8 implements the BASE64 codec API, which contains the Java.util package. I'm going to do
PackageCom.education.util;ImportSun.misc.BASE64Decoder;ImportSun.misc.BASE64Encoder;ImportJava.io.*;/*** Created by Jn-dinggao on 2016/2/4.*/ Public classBase64util {//Converts a picture file into a byte array string and Base64 it for encoding
Encode the image with Base64,
From http://commons.apache.org/proper/commons-codec/download_codec.cgi
Download commons-codec-1.9-bin.zip unzip get the commons-codec-1.9.jar to add the jar package to the Java project created by eclipse, You can
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.