|
@@ -5,7 +5,11 @@ import com.google.gson.JsonArray;
|
|
|
import com.google.gson.JsonObject;
|
|
import com.google.gson.JsonObject;
|
|
|
import com.google.gson.JsonParser;
|
|
import com.google.gson.JsonParser;
|
|
|
import com.xjrsoft.common.utils.ImageUtil;
|
|
import com.xjrsoft.common.utils.ImageUtil;
|
|
|
|
|
+import com.xjrsoft.common.utils.PictureUtil;
|
|
|
|
|
|
|
|
|
|
+import javax.imageio.ImageIO;
|
|
|
|
|
+import java.awt.image.BufferedImage;
|
|
|
|
|
+import java.io.ByteArrayInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.FileOutputStream;
|
|
import java.io.FileOutputStream;
|
|
@@ -88,7 +92,6 @@ public class FaceImportUtil {
|
|
|
if(personPhoto.size() > 0){
|
|
if(personPhoto.size() > 0){
|
|
|
faceId = personPhoto.get(0).getAsJsonObject().get("personPhotoIndexCode").getAsString();
|
|
faceId = personPhoto.get(0).getAsJsonObject().get("personPhotoIndexCode").getAsString();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
String response = null;
|
|
String response = null;
|
|
@@ -128,6 +131,12 @@ public class FaceImportUtil {
|
|
|
//压缩到200k
|
|
//压缩到200k
|
|
|
imageBytes = ImageUtil.compressUnderSize(imageBytes, 204800);
|
|
imageBytes = ImageUtil.compressUnderSize(imageBytes, 204800);
|
|
|
|
|
|
|
|
|
|
+ InputStream input = new ByteArrayInputStream(imageBytes);
|
|
|
|
|
+ BufferedImage image = ImageIO.read(input);
|
|
|
|
|
+ BufferedImage rotatedImage = PictureUtil.rotatePhonePhoto(image, 1);
|
|
|
|
|
+
|
|
|
|
|
+ imageBytes = PictureUtil.convertBufferedImageToByteArray(rotatedImage);
|
|
|
|
|
+
|
|
|
//压缩之后,存入本地
|
|
//压缩之后,存入本地
|
|
|
String[] split = imageUrl.split("\\.");
|
|
String[] split = imageUrl.split("\\.");
|
|
|
String suffix = split[split.length - 1];
|
|
String suffix = split[split.length - 1];
|