diff --git a/client/media/imageInputFileToBase64.js b/client/media/imageInputFileToBase64.js index e17ba1d..078e1e9 100644 --- a/client/media/imageInputFileToBase64.js +++ b/client/media/imageInputFileToBase64.js @@ -15,13 +15,17 @@ * * @param {{ * imageInputFile: { name:string }, - * maxWidth: number, - * imagePreviewNode: HTMLImageElement, + * maxWidth?: number, + * imagePreviewNode?: HTMLImageElement, * }} params - Single object passed * * @returns { Promise } - Return Object */ -module.exports = async function imageInputFileToBase64({ imageInputFile, maxWidth, imagePreviewNode }) { +module.exports = async function imageInputFileToBase64({ + imageInputFile, + maxWidth, + imagePreviewNode, +}) { /** * Make https request * @@ -58,8 +62,14 @@ module.exports = async function imageInputFileToBase64({ imageInputFile, maxWidt if (MAX_WIDTH) { const scaleSize = MAX_WIDTH / img.naturalWidth; - canvas.width = img.naturalWidth < MAX_WIDTH ? img.naturalWidth : MAX_WIDTH; - canvas.height = img.naturalWidth < MAX_WIDTH ? img.naturalHeight : img.naturalHeight * scaleSize; + canvas.width = + img.naturalWidth < MAX_WIDTH + ? img.naturalWidth + : MAX_WIDTH; + canvas.height = + img.naturalWidth < MAX_WIDTH + ? img.naturalHeight + : img.naturalHeight * scaleSize; } else { canvas.width = img.naturalWidth; canvas.height = img.naturalHeight; diff --git a/client/media/imageInputToBase64.js b/client/media/imageInputToBase64.js index adebad9..30d128b 100644 --- a/client/media/imageInputToBase64.js +++ b/client/media/imageInputToBase64.js @@ -14,20 +14,26 @@ * * @param {{ * imageInput: HTMLInputElement, - * maxWidth: number, - * mimeType: [string='image/jpeg'] + * maxWidth?: number, + * mimeType?: [string='image/jpeg'] * }} params - Single object passed * * @returns { Promise } - Return Object */ -module.exports = async function imageInputToBase64({ imageInput, maxWidth, mimeType }) { +module.exports = async function imageInputToBase64({ + imageInput, + maxWidth, + mimeType, +}) { /** * Make https request * * @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 imageDataBase64; @@ -58,8 +64,14 @@ module.exports = async function imageInputToBase64({ imageInput, maxWidth, mimeT if (MAX_WIDTH) { const scaleSize = MAX_WIDTH / img.naturalWidth; - canvas.width = img.naturalWidth < MAX_WIDTH ? img.naturalWidth : MAX_WIDTH; - canvas.height = img.naturalWidth < MAX_WIDTH ? img.naturalHeight : img.naturalHeight * scaleSize; + canvas.width = + img.naturalWidth < MAX_WIDTH + ? img.naturalWidth + : MAX_WIDTH; + canvas.height = + img.naturalWidth < MAX_WIDTH + ? img.naturalHeight + : img.naturalHeight * scaleSize; } else { canvas.width = img.naturalWidth; canvas.height = img.naturalHeight; @@ -71,9 +83,11 @@ module.exports = async function imageInputToBase64({ imageInput, maxWidth, mimeT const srcEncoded = canvas.toDataURL(MIME_TYPE, QUALITY); if (imagePreviewNode) { - document.querySelectorAll(`[data-imagepreview='image']`).forEach((img) => { - img.src = srcEncoded; - }); + document + .querySelectorAll(`[data-imagepreview='image']`) + .forEach((img) => { + img.src = srcEncoded; + }); } res(srcEncoded); diff --git a/package.json b/package.json index b26bc0f..cf39f90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.9.5", + "version": "1.9.6", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/publish.sh b/publish.sh new file mode 100644 index 0000000..bf341f5 --- /dev/null +++ b/publish.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$1" ]; then + msg="Updates" +else + msg="$1" +fi + +git add . && git commit -m "$msg" && git push && npm publish \ No newline at end of file diff --git a/push.sh b/push.sh new file mode 100644 index 0000000..12b207b --- /dev/null +++ b/push.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$1" ]; then + msg="Updates" +else + msg="$1" +fi + +git add . && git commit -m "$msg" && git push