Created
April 26, 2020 10:32
-
-
Save trgino/127c7eeb8c5ff6aa0daf7479e868f777 to your computer and use it in GitHub Desktop.
lazy svg placeholder
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 characters
function svg_base64($w,$h){ | |
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="'.$w.'" height="'.$h.'" viewBox="0 0 '.$w.' '.$h.'"><rect fill="#fff" width="'.$w.'" height="'.$h.'"/></svg>'; | |
$svg = 'data:image/svg+xml;base64,'.base64_encode($svg); | |
return $svg; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment