Commit afa07d7f authored by yaobaizheng's avatar yaobaizheng

图片过大进行二次压缩

parent 18308d0f
......@@ -32,7 +32,7 @@ public class PicUtils {
File file = new File(pc_url);
File file1 = new File(pc_url1);
compressPicForScale1(file,file1,800);
compressPicForScale(file,file1,1024);
}
......@@ -45,7 +45,7 @@ public class PicUtils {
//目标文件
File file1 = FileUtil.file(localDir1);
compressPicForScale1(file, file1, 800);
compressPicForScale(file, file1, 1024);
}
......@@ -57,7 +57,7 @@ public class PicUtils {
* @param desFileSize 指定图片大小,单位kb
* @return 压缩质量后的图片字节数组
*/
public static void compressPicForScale1(File file, File newFile, long desFileSize) throws IOException {
public static void compressPicForScale(File file, File newFile, long desFileSize) throws IOException {
long fileLength = file.length();
if ( fileLength <= 0 || fileLength < desFileSize * 1024) {
return ;
......@@ -81,9 +81,6 @@ public class PicUtils {
private static double getAccuracy(long size) {
double accuracy = 1 ;
if (size >= 800 && size < 1024) {
accuracy = 0.6;
}
if (size >= 1024 && size < 1500) {
accuracy = 0.2;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment