@@ -78,12 +78,17 @@ const outputFormatHasQuality = computed(() => {
78
78
79
79
const svgWasmLoaded = ref (false );
80
80
81
+ async function onFilesUploaded(uploadedFiles : File []) {
82
+ for (const file of uploadedFiles ) {
83
+ await onFileUploaded (file );
84
+ }
85
+ }
81
86
async function onFileUploaded(uploadedFile : File ) {
82
87
const outputFormatValue = outputFormat .value ;
83
88
file .value = uploadedFile ;
84
89
let fileBuffer = new Uint8Array (await uploadedFile .arrayBuffer ());
85
90
86
- fileName .value = ` ${ uploadedFile .name } ` ;
91
+ fileName .value = uploadedFile .name . replace ( / \. \w + $ / , ' ' ) ;
87
92
status .value = ' processing' ;
88
93
try {
89
94
if (outputFormatValue === ' webp' ) {
@@ -128,16 +133,7 @@ async function onFileUploaded(uploadedFile: File) {
128
133
129
134
<template >
130
135
<div >
131
- <div style =" flex : 0 0 100% " mb-2 >
132
- <div mx-auto max-w-600px >
133
- <c-file-upload
134
- title =" Drag and drop an image file here, or click to select a file"
135
- accept =" image/*"
136
- paste-image
137
- @file-upload =" onFileUploaded"
138
- />
139
- </div >
140
- </div >
136
+ <h4 >First, select output options:</h4 >
141
137
142
138
<c-select
143
139
v-model:value =" outputFormat"
@@ -157,6 +153,21 @@ async function onFileUploaded(uploadedFile: File) {
157
153
</n-form-item >
158
154
</div >
159
155
156
+ <h4 >Then, drag and drop your images below and they will be converted and downloaded immediately:</h4 >
157
+
158
+ <div style =" flex : 0 0 100% " mb-2 >
159
+ <div mx-auto max-w-600px >
160
+ <c-file-upload
161
+ title =" Drag and drop images files here, or click to select some files"
162
+ accept =" image/*"
163
+ paste-image
164
+ multiple
165
+ @file-upload =" onFileUploaded"
166
+ @files-upload =" onFilesUploaded"
167
+ />
168
+ </div >
169
+ </div >
170
+
160
171
<div mt-3 flex justify-center >
161
172
<c-alert v-if =" status === 'error'" type =" error" >
162
173
An error occured processing {{ fileName }}
0 commit comments