图片上传最简单的方式是在前端将图片转为base64传到后台,后台可以直接保存到数据库,或者将base64转为图片保存,返回图片访问路径。
js(图片转base64),这里要注意,如果需用用base64回显图片的话,要加上前缀(data:image/png;base64,)
//压缩图片转成base64 function getBase64Image(img) { var canvas = document.createElement("canvas"); var width = img.width; var height = img.height; if (width > height) { if (width > 100) { height = Math.round(height *= 100 / width); width = 100; } } else { if (height > 100) { width = Math.round(width *= 100 / height); } height = 100; } canvas.width = width; canvas.height = height; var ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0, width, height); var dataUrl = canvas.toDataURL('image/png', 0.8); var n1 = dataUrl.length; var n2 = dataUrl.indexOf(","); var Data = decodeURI(dataUrl.substr(n2 + 1, n1 - n2)); return Data; }
java(base64转为图片保存),base64转图片的时候,要将前缀 data:image/png;base64, 去掉,否则会导致图片打开失败
package SSM.api.apiutils; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import java.io.*; /** * @author zhouhe * @date 2020/7/9 10:04 */ public class ImageUtils { /** * base64 转图片 * @param imgFilePath * @return */ public static String GetImageStr(String imgFilePath) {// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理 byte[] data = null; // 读取图片字节数组 try { InputStream in = new FileInputStream(imgFilePath); data = new byte[in.available()]; in.read(data); in.close(); } catch (IOException e) { e.printStackTrace(); } // 对字节数组Base64编码 BASE64Encoder encoder = new BASE64Encoder(); return encoder.encode(data);// 返回Base64编码过的字节数组字符串 } public static boolean GenerateImage(String imgStr, String imgFilePath) {// 对字节数组字符串进行Base64解码并生成图片 if (imgStr == null) // 图像数据为空 return false; BASE64Decoder decoder = new BASE64Decoder(); try { // Base64解码 byte[] bytes = decoder.decodeBuffer(imgStr); for (int i = 0; i < bytes.length; ++i) { if (bytes[i] < 0) {// 调整异常数据 bytes[i] += 256; } } // 生成jpeg图片 OutputStream out = new FileOutputStream(imgFilePath); out.write(bytes); out.flush(); out.close(); return true; } catch (Exception e) { return false; } } public static void main(String[] args){ // 测试从Base64编码转换为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QII81eFR+kgLqwNBjfRicd04Ox1zEuZH6YxldL9FRjUhKOpW4siuRhNvLrtCj/TggrvydPb0lAsi+9iqwt1QU0tp07gb6TwzBDddjLu7cSP2xfEJp71DuUP9CV97LbR8eElZgBzJtsTLRSfuHO9C9L3KE0N6FbryKQVdXyPWYiz03UnfUSDA/gpHRDHaUdcbB14aQCa2KiF32iqv+iX5kK+xhuY559fXIWqZGhCLJig5ZVjQsrvKjxqooa3IZi7Vcx1xSPbJWWT6hSBelbQ86F7ryqu2is1fKUEkRtI2oAL6ULJ4T8UhmdwceEUtWWJhFWRPXY17VuZF6IqEyO8/24RHZweOfF82QCLKB7sNl7VXWK2O2Z0VgXLZdHlMF0mXZKkvYiUX744t1ulyP6Vhvob/Vkv5uZDWwrOnh7PFe7B/txbHDA8JNMqjxjGy0fVinXLujViolu/BYhenE24cqC8nlnByOeXXnRuoF3o9CiAM1FMwTUrtQKIQ4QKEQ4gCFQogDFAohDlAohDhAoRDiAIVCiAMUCiEOUCiEOEChEOIAhUKIA/8fA3zaNYTD0cAAAAAASUVORK5CYII="; GenerateImage(strImge, "D:\11.png"); // 测试从图片文件转换为Base64编码 // System.out.println(GetImageStr("d:\11.jpg")); } }