Share on Google+Share on Google+

php gd image create from string

This example shows how to display image from string in php gd Library.




. 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'

. '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';

$String = base64_decode($String);

$image = imagecreatefromstring($String);

if ($image !== false) {

header('Content-Type: image/png');



else {

echo 'An error occured.';



After running the program you will get the following output


Posted on: November 2, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.


Advertisement null