Merge pull request #2388 from Yanyutin753/uploadImage

 Expend upload image file types
This commit is contained in:
Timothy Jaeryang Baek 2024-05-19 01:40:08 -10:00 committed by GitHub
commit 0ede1d1483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -357,7 +357,7 @@
if (inputFiles && inputFiles.length > 0) { if (inputFiles && inputFiles.length > 0) {
inputFiles.forEach((file) => { inputFiles.forEach((file) => {
console.log(file, file.name.split('.').at(-1)); console.log(file, file.name.split('.').at(-1));
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) { if (['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(file['type'])) {
let reader = new FileReader(); let reader = new FileReader();
reader.onload = (event) => { reader.onload = (event) => {
files = [ files = [
@ -547,7 +547,7 @@
if (inputFiles && inputFiles.length > 0) { if (inputFiles && inputFiles.length > 0) {
const _inputFiles = Array.from(inputFiles); const _inputFiles = Array.from(inputFiles);
_inputFiles.forEach((file) => { _inputFiles.forEach((file) => {
if (['image/gif', 'image/jpeg', 'image/png'].includes(file['type'])) { if (['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(file['type'])) {
let reader = new FileReader(); let reader = new FileReader();
reader.onload = (event) => { reader.onload = (event) => {
files = [ files = [

View File

@ -127,7 +127,7 @@
if ( if (
files.length > 0 && files.length > 0 &&
['image/gif', 'image/jpeg', 'image/png'].includes(files[0]['type']) ['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(files[0]['type'])
) { ) {
reader.readAsDataURL(files[0]); reader.readAsDataURL(files[0]);
} }

View File

@ -339,7 +339,7 @@ SYSTEM """${system}"""`.replace(/^\s*\n/gm, '');
if ( if (
inputFiles && inputFiles &&
inputFiles.length > 0 && inputFiles.length > 0 &&
['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type'])
) { ) {
reader.readAsDataURL(inputFiles[0]); reader.readAsDataURL(inputFiles[0]);
} else { } else {

View File

@ -238,7 +238,7 @@
if ( if (
inputFiles && inputFiles &&
inputFiles.length > 0 && inputFiles.length > 0 &&
['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ['image/gif', 'image/webp', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type'])
) { ) {
reader.readAsDataURL(inputFiles[0]); reader.readAsDataURL(inputFiles[0]);
} else { } else {