Skip to content

Instantly share code, notes, and snippets.

@trgino
Created April 26, 2020 10:32
Show Gist options
  • Save trgino/127c7eeb8c5ff6aa0daf7479e868f777 to your computer and use it in GitHub Desktop.
Save trgino/127c7eeb8c5ff6aa0daf7479e868f777 to your computer and use it in GitHub Desktop.
lazy svg placeholder
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