Created
November 15, 2022 17:03
-
-
Save andreasvirkus/a813132542b38ff421aa0b83cc27e771 to your computer and use it in GitHub Desktop.
Revisions
-
andreasvirkus created this gist
Nov 15, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ function resizeImage(el, width, height, quality) { var canvas = document.createElement('canvas') canvas.width = width canvas.height = height var context = canvas.getContext('2d') context.drawImage(el, 0, 0, width, height) try { return canvas.toDataURL('image/jpeg', quality) } catch (e) { return null } }