From 840ad758303e3049a505a4eb26dc751d636adbec Mon Sep 17 00:00:00 2001
From: syuilo <syuilotan@yahoo.co.jp>
Date: Wed, 14 Nov 2018 18:00:15 +0900
Subject: [PATCH] [Client] Better thumbnail generation

---
 src/client/app/common/views/components/uploader.vue | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/client/app/common/views/components/uploader.vue b/src/client/app/common/views/components/uploader.vue
index 029a42158d..ec804dff35 100644
--- a/src/client/app/common/views/components/uploader.vue
+++ b/src/client/app/common/views/components/uploader.vue
@@ -57,17 +57,11 @@ export default Vue.extend({
 						return;
 					}
 
-					// Upload if the file didn't exist yet
-					const buf = new Uint8Array(e.target.result);
-					let bin = '';
-					// We use for-of loop instead of apply() to avoid RangeError
-					// SEE: https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string
-					for (const byte of buf) bin += String.fromCharCode(byte);
 					const ctx = {
 						id: id,
 						name: file.name || 'untitled',
 						progress: undefined,
-						img: 'data:*/*;base64,' + btoa(bin)
+						img: window.URL.createObjectURL(file)
 					};
 
 					this.uploads.push(ctx);