Pass the ESLINT and Typescript build
This commit is contained in:
parent
cea7a5bc9d
commit
32c3debad4
8 changed files with 115 additions and 98 deletions
|
@ -1,4 +1,4 @@
|
|||
export function resizeBase64Image(base64Image) {
|
||||
export function resizeBase64Image(base64Image: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const maxSizeInKB = 500;
|
||||
const maxSizeInBytes = maxSizeInKB * 1024;
|
||||
|
@ -14,7 +14,7 @@ export function resizeBase64Image(base64Image) {
|
|||
const newHeight = Math.sqrt(maxSizeInBytes / aspectRatio);
|
||||
canvas.width = newWidth;
|
||||
canvas.height = newHeight;
|
||||
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
||||
ctx!.drawImage(img, 0, 0, newWidth, newHeight);
|
||||
let quality = 0.8;
|
||||
let dataURL = canvas.toDataURL('image/jpeg', quality);
|
||||
resolve(dataURL);
|
||||
|
@ -22,7 +22,7 @@ export function resizeBase64Image(base64Image) {
|
|||
});
|
||||
}
|
||||
|
||||
export function getBase64OfImage(file, cb) {
|
||||
export function getBase64OfImage(file: any, cb: any) {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue