From ccabc8273299171c68c00c6f749a8041b9dc692a Mon Sep 17 00:00:00 2001 From: src48597962 <48597962@qq.com> Date: Fri, 4 Aug 2023 15:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'SrcJuMethod.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SrcJuMethod.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/SrcJuMethod.js b/SrcJuMethod.js index 1d080dc8..8d04cbfb 100644 --- a/SrcJuMethod.js +++ b/SrcJuMethod.js @@ -92,6 +92,10 @@ function banner(start, arr, data, cfg){ //图片压缩 function imageCompress(imgurl,fileid) { function compress(path, inSampleSize, topath) { + let tmpfile = "hiker://files/_cache/1.txt"; + if (!fileExist(tmpfile)) { + writeFile(tmpfile, ''); + } const Bitmap = android.graphics.Bitmap; const BitmapFactory = android.graphics.BitmapFactory; const FileOutputStream = java.io.FileOutputStream; @@ -109,10 +113,6 @@ function imageCompress(imgurl,fileid) { bitmap = BitmapFactory.decodeFile(path, options); topath = topath || path; } - let tmpfile = "hiker://files/_cache/1.txt"; - if (!fileExist(tmpfile)) { - writeFile(tmpfile, ''); - } let os = new FileOutputStream(topath); let s = false; try { @@ -163,12 +163,12 @@ function imageCompress(imgurl,fileid) { log(size); if(size>1080){ log(parseInt(size/1080)); - let newpath = "/storage/emulated/0/Android/data/com.example.hikerview/files/Documents/_cache/"+(fileid||"")+"_"+getName(imgurl); - log(newpath); - let r = compress(f, 3, newpath); - if(r){ - return "file://" + newpath; - } + //let newpath = "/storage/emulated/0/Android/data/com.example.hikerview/files/Documents/_cache/"+(fileid||"")+"_"+getName(imgurl); + let newpath = "/storage/emulated/0/Android/data/com.example.hikerview/files/Documents/_cache/1.jpg"; + compress(f, 8, newpath); + //if(r){ + // return "file://" + newpath; + //} } return imgurl; }