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;
|
package com.jasamedika.medifirst2000.service.impl;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -13,9 +13,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import javax.xml.bind.DatatypeConverter;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -197,17 +195,19 @@ public class AbsensiPegawaiServiceImpl extends BaseVoServiceImpl implements Abse
|
|||||||
+ trNo + ".jpg";
|
+ trNo + ".jpg";
|
||||||
|
|
||||||
String str = imageURLData;
|
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);
|
File dire = new File(directory);
|
||||||
if (!dire.exists()) {
|
if (!dire.exists()) {
|
||||||
dire.mkdirs();
|
dire.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = new File(filename);
|
File outputFile = new File(filename);
|
||||||
ImageIO.write(bufferedImage, "jpg", file);
|
|
||||||
|
OutputStream stream = new FileOutputStream(outputFile);
|
||||||
|
stream.write(imagedata);
|
||||||
|
stream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user