This commit is contained in:
Tben 2023-05-23 16:14:35 +01:00
parent 285c82193f
commit 5ca2983100
3 changed files with 135 additions and 114 deletions

View File

@ -27,6 +27,7 @@ export default async function imageInputFileToBase64({ imageInputFile, maxWidth,
* *
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
*/ */
try {
console.log(typeof imageInputFile); console.log(typeof imageInputFile);
let imageName = imageInputFile.name.replace(/\..*/, ""); let imageName = imageInputFile.name.replace(/\..*/, "");
@ -97,6 +98,16 @@ export default async function imageInputFileToBase64({ imageInputFile, maxWidth,
imageName: imageName, imageName: imageName,
imageSize: imageSize, imageSize: imageSize,
}; };
} catch (error) {
console.log("Image Processing Error! =>", error.message);
return {
imageBase64: null,
imageBase64Full: null,
imageName: null,
imageSize: null,
};
}
} }
/** ********************************************** */ /** ********************************************** */

View File

@ -26,6 +26,7 @@ export default async function imageInputToBase64({ imageInput, maxWidth, mimeTyp
* *
* @description make a request to datasquirel.com * @description make a request to datasquirel.com
*/ */
try {
let imagePreviewNode = document.querySelector(`[data-imagepreview='image']`); let imagePreviewNode = document.querySelector(`[data-imagepreview='image']`);
let imageName = imageInput.files[0].name.replace(/\..*/, ""); let imageName = imageInput.files[0].name.replace(/\..*/, "");
let imageDataBase64; let imageDataBase64;
@ -84,6 +85,15 @@ export default async function imageInputToBase64({ imageInput, maxWidth, mimeTyp
imageBase64Full: imageDataBase64, imageBase64Full: imageDataBase64,
imageName: imageName, imageName: imageName,
}; };
} catch (error) {
console.log("Image Processing Error! =>", error.message);
return {
imageBase64: null,
imageBase64Full: null,
imageName: null,
};
}
} }
/** ********************************************** */ /** ********************************************** */

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.1.30", "version": "1.1.31",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {