Last active
November 19, 2020 14:36
-
-
Save makingthingswork/68be1a8a25320d70ec5046d0624399d3 to your computer and use it in GitHub Desktop.
Change width and height of HTML (string) element
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
<?php | |
function change_dimensions(str, width = '600', height = '450'){ | |
return preg_replace(array('/width="\S+"/i', '/height="\S+"/i'),array(sprintf('width="%s"', width), sprintf('height="%s"', height)), str); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment