mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-05 10:18:09 +09:00
[Client] Better thumbnail generation
This commit is contained in:
parent
4c7dd7228f
commit
840ad75830
@ -57,17 +57,11 @@ export default Vue.extend({
|
|||||||
return;
|
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 = {
|
const ctx = {
|
||||||
id: id,
|
id: id,
|
||||||
name: file.name || 'untitled',
|
name: file.name || 'untitled',
|
||||||
progress: undefined,
|
progress: undefined,
|
||||||
img: 'data:*/*;base64,' + btoa(bin)
|
img: window.URL.createObjectURL(file)
|
||||||
};
|
};
|
||||||
|
|
||||||
this.uploads.push(ctx);
|
this.uploads.push(ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user