Skip to content

Commit 9782d8a

Browse files
authored
multiple image compress
fix when compress multiple images only works on first jpg image problem. compressed images send by seperated request, need to be optimized.
1 parent dca8ba8 commit 9782d8a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/vue-core-image-upload.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@
104104
return;
105105
}
106106
this. __dispatch('imagechanged', this.files.length > 1 ? this.files : this.files[0]);
107-
if (this.compress && this.files[0]['type'] !== 'image/png' && this.files[0]['type'] !== 'image/gif') {
108-
canvasHelper.compress(this.files[0], 100 - this.compress, (code) => {
107+
if (this.compress) {
108+
canvasHelper.compress(this.files, 100 - this.compress, (code) => {
109109
this.tryAjaxUpload('', true, code);
110110
});
111111
} else {
@@ -264,10 +264,10 @@
264264
let data;
265265
if (isBinary) {
266266
data = {
267-
type: this.files[0]['type'],
268-
filename: encodeURI(this.files[0]['name']),
267+
type: base64Code['type'],
268+
filename: encodeURI(base64Code['name']),
269269
filed: this.inputOfFile,
270-
base64Code: base64Code
270+
base64Code: base64Code['base64Code']
271271
};
272272
if (typeof this.data === 'object') {
273273
data = Object.assign(this.data, data);

0 commit comments

Comments
 (0)