File tree Expand file tree Collapse file tree 10 files changed +16
-11
lines changed Expand file tree Collapse file tree 10 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 14
14
"jszip" : " ^3.10.1" ,
15
15
"pinia" : " ^2.1.6" ,
16
16
"sass" : " ^1.64.1" ,
17
- "simple-image-compressor" : " ^1.2.1 " ,
17
+ "simple-image-compressor" : " ^1.4.0 " ,
18
18
"vue" : " ^3.4.19" ,
19
19
"vue-i18n" : " ^9.8.0"
20
20
},
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ async function editFileObj(fileObj: FileObj) {
29
29
fileObj .file = compressedFile ;
30
30
fileObj .isCompressed = true ;
31
31
} catch {
32
- fileObj .isTooLarge = true ;
32
+ fileObj .isError = true ;
33
33
}
34
34
}
35
35
@@ -38,13 +38,18 @@ async function compressFiles() {
38
38
39
39
const uncompressedFiles = files .value .filter ((fileObj : FileObj ) => ! fileObj .isCompressed );
40
40
41
+ // option 1 (no errors, slower)
41
42
const paginatedFileArray = paginate (uncompressedFiles , availableThreads );
42
43
43
44
for (const subArray of paginatedFileArray ) {
44
45
const promises = subArray .map (editFileObj );
45
46
await Promise .all (promises );
46
47
}
47
48
49
+ // option 2 (errors, faster -> better option once the errors are fixed in Firefox)
50
+ // const promises = uncompressedFiles.map(editFileObj);
51
+ // await Promise.all(promises);
52
+
48
53
isCompressing .value = false ;
49
54
50
55
URL .revokeObjectURL (zipData .value );
Original file line number Diff line number Diff line change @@ -57,10 +57,10 @@ onUnmounted(() => URL.revokeObjectURL(objectUrl.value));
57
57
<span class =" field-title" >{{ t('translation.compressedsize') }}</span > {{ computeFileSize(compSize) }}MB
58
58
</div >
59
59
<div
60
- v-if =" fileObj.isTooLarge "
60
+ v-if =" fileObj.isError "
61
61
class =" error"
62
62
>
63
- <span class =" field-title" >{{ t('translation.error') }}</span > {{ t('translation.filetoolarge ') }}
63
+ <span class =" field-title" >{{ t('translation.error') }}</span > {{ t('translation.hasFailed ') }}
64
64
</div >
65
65
</div >
66
66
</div >
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ function addFiles(uploadedFiles: FileList) {
32
32
const fileObj: FileObj = {
33
33
id: id ++ ,
34
34
isCompressed: false ,
35
- isTooLarge : false ,
35
+ isError : false ,
36
36
file ,
37
37
};
38
38
files .value .push (fileObj );
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default {
7
7
compressedsize : 'Komprimierte Größe:' ,
8
8
download : 'Herunterladen' ,
9
9
error : 'Fehler:' ,
10
- filetoolarge : 'Datei ist zu groß! ' ,
10
+ hasFailed : 'Datei konnte nicht komprimiert werden ' ,
11
11
header : 'Bild Kompressor' ,
12
12
subtitle : 'Komprimiert Bilder auf < 10MB' ,
13
13
buttonwiki : 'NMS Wiki Bild Upload öffnen' ,
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default {
7
7
compressedsize : 'Compressed Size:' ,
8
8
download : 'Download' ,
9
9
error : 'Error:' ,
10
- filetoolarge : ' File is too large!' ,
10
+ hasFailed : " File couldn't be compressed" ,
11
11
header : 'Image Compressor' ,
12
12
subtitle : 'Compresses images to < 10MB' ,
13
13
buttonwiki : 'Open NMS Wiki Image Upload' ,
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default {
7
7
compressedsize : 'Tamaño comprimido:' ,
8
8
download : 'Descargar' ,
9
9
error : 'Error:' ,
10
- filetoolarge : '¡El archivo es demasiado grande!' ,
10
+ hasFailed : '¡El archivo es demasiado grande!' ,
11
11
header : 'Compresor de imágenes' ,
12
12
subtitle : 'Comprime imágenes a <10 MB' ,
13
13
buttonwiki : 'Abrir página carga imágenes Wiki NMS' ,
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default {
7
7
compressedsize : 'Tamaina komprimatuta:' ,
8
8
download : 'Deskargatu' ,
9
9
error : 'Akats:' ,
10
- filetoolarge : 'Fitxategia handiegia da!' ,
10
+ hasFailed : 'Fitxategia handiegia da!' ,
11
11
header : 'Irudi-konpresorea' ,
12
12
subtitle : 'Konprimitu irudiak < 10 MBra' ,
13
13
buttonwiki : 'Ireki NMS Wiki-ko argazkiak igotzeko orria' ,
Original file line number Diff line number Diff line change 1
1
export interface FileObj {
2
2
id : number ;
3
3
isCompressed : boolean ;
4
- isTooLarge : boolean ;
4
+ isError : boolean ;
5
5
file : File ;
6
6
}
You can’t perform that action at this time.
0 commit comments