We all like to talk about the college entrance examination, but I do not want to mention, because the author of the college Entrance examination is not ideal, so depressed. Later, it was a crush on the game until last month, it can be said that it has been ignorant for a long time. The hot temper is followed, although the time is no longer, temper still exists. What to do, the author uses hbuilder write something to eliminate the fire. I'm glad to have a little chatter. The following code is directly on:
<! DOCTYPE html>
Next, we click Launch Camera.
When you choose to take a photo, the photo data is sent to the background in a binary encoded format for storage.
//1、处理Base64图片代码 String imgaePath = "c:\\"+DateUtil.getTimestamp()+"20180820.jpg"; GenerateImage(imagedata, imgaePath);
```//对字节数组字符串进行Base64解码,并生成图片 20180820private void GenerateImage(String imagedata, String imgaePath) { if(imagedata.isEmpty()){//判断图像数据是否为空 return; } BASE64Decoder decoder = new BASE64Decoder(); try {//进行Base64解码 byte[] bytes = decoder.decodeBuffer(imagedata); for (int i = 0; i < bytes.length; i++) { if(bytes[i] < 0){//调整异常数据 bytes[i] += 256; } } //生成jpeg图片 OutputStream out = new FileOutputStream(imgaePath); out.write(bytes); out.flush(); out.close(); return; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }}
接下来,你会在你的电脑C盘下,找到这张照片。
好了,笔者要去吃鸡了。
The browser uses Webcam+flash to enable the camera and complete the photo