Skip to content

Instantly share code, notes, and snippets.

@anmolio
Last active March 9, 2020 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anmolio/5ac0dc8bca872b2a1e4536d0ac6ee13b to your computer and use it in GitHub Desktop.
Save anmolio/5ac0dc8bca872b2a1e4536d0ac6ee13b to your computer and use it in GitHub Desktop.
PHP code to convert base 64 string to an image.
<?php
$base64String = "R0lGODdhAQABAPAAAP8AAAAAACwAAAAAAQABAAACAkQBADs";
$image = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '',$base64String));
$FILE = time().rand(111111111, 999999999) . '.png';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment