Created
October 14, 2018 04:29
-
-
Save JKirchartz/0af002c96546922ce5eee710b62d4ecc to your computer and use it in GitHub Desktop.
Javascript to manipulate image in @jkirchartz_exe
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
var text = document.getElementById('text'); | |
text.setAttribute('textLength', Math.round(text.clientWidth / 1.1)); | |
text.style.fontSize = Math.round(text.clientWidth / text.textContent.length) + 'px'; | |
var img=document.getElementById('image'); | |
img.onload=function(){ | |
var svg=document.getElementById('svg'); | |
svg.height=img.naturalHeight; | |
svg.width=img.naturalWidth; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment