function imgToBase64(url,) {
let canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'),
img = new Image
img.crossOrigin = 'Anonymous'
img.src = url
img.onload = () => {
canvas.height = img.height
canvas.width = img.width
ctx.drawImage(img, 0, 0)
let dataURL = canvas.toDataURL('image/png')
callback(dataURL)
canvas = null
}
}

function base64ToFile(data,) {
let base = window.atob(data.substring(data.indexOf(',') + 1))
let length = base.length
let url = new Uint8Array(length)
while (length--) {
url[length] = base.charCodeAt(length)
}
let file = new File([url], `${new Date().getTime()}.jpg`, {
type: 'image/jpg'
})
callback(file)
}