Update AbsensiPegawaiService
Penerapan kualitas resolusi penyimpanan capture presensi
This commit is contained in:
parent
291101387f
commit
7319759239
@ -1,9 +1,9 @@
|
||||
package com.jasamedika.medifirst2000.service.impl;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -13,9 +13,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -197,17 +195,19 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
||||
+ trNo + ".jpg";
|
||||
|
||||
String str = imageURLData;
|
||||
byte[] imagedata = DatatypeConverter.parseBase64Binary(str.substring(str.indexOf(",") + 1));
|
||||
try {
|
||||
BufferedImage bufferedImage = ImageIO.read(new ByteArrayInputStream(imagedata));
|
||||
|
||||
byte[] imagedata = Base64.decodeBase64(str.substring(str.indexOf(",") + 1));
|
||||
try {
|
||||
File dire = new File(directory);
|
||||
if (!dire.exists()) {
|
||||
dire.mkdirs();
|
||||
}
|
||||
|
||||
File file = new File(filename);
|
||||
ImageIO.write(bufferedImage, "jpg", file);
|
||||
File outputFile = new File(filename);
|
||||
|
||||
OutputStream stream = new FileOutputStream(outputFile);
|
||||
stream.write(imagedata);
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user