-
-
Save parzibyte/8f655f6b05e00b38388b9ec407bc528f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$btnDescargar.onclick = () => { | |
if (!cropper) { | |
return; | |
} | |
// Obtener el canvas recortado | |
const canvas = cropper.getCroppedCanvas(); | |
// Aquí ya podemos hacer cualquier cosa con el canvas | |
let enlace = document.createElement('a'); | |
// Nombre de la imagen que se descarga | |
enlace.download = "imagen_recortada." + EXTENSION_IMAGEN_DESCARGADA; | |
enlace.href = canvas.toDataURL(MIME_TYPE_IMAGEN_DESCARGADA, CALIDAD_JPG); | |
enlace.click(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment