Home Tutorial Php Phpgd php gd image create from string

 
 

Share on Google+Share on Google+
php gd image create from string
Posted on: November 2, 2009 at 12:00 AM
Advertisement
This example shows how to display image from string in php gd Library.

<?php

$String = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'

. 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'

. 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'

. '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';

$String = base64_decode($String);

$image = imagecreatefromstring($String);

if ($image !== false) {

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

imagepng($image);

}

else {

echo 'An error occured.';

}

?>

After running the program you will get the following output

Advertisement

Related Tags for php gd image create from string:


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.

Posted on: November 2, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com