jacko_162 Posted March 24, 2010 Share Posted March 24, 2010 I have a website that stores user data. a few users have requested if its possible to generate an image with data embedded? is this possible, i have seen forum signatures use a similar thing before and im not 100% what to search and look for. any help is appreciated. Link to comment https://forums.phpfreaks.com/topic/196338-creating-images-using-data/ Share on other sites More sharing options...
JonnoTheDev Posted March 24, 2010 Share Posted March 24, 2010 Yes it is possible. Have a look at the graphics functions that php provides with its GD library. http://uk3.php.net/manual/en/book.image.php Link to comment https://forums.phpfreaks.com/topic/196338-creating-images-using-data/#findComment-1030962 Share on other sites More sharing options...
jacko_162 Posted March 24, 2010 Author Share Posted March 24, 2010 thank you for the heads up. been having a play with it and using the following code; <?php header("Content-type: image/png"); $string = $_GET['text']; $im = imagecreatefrompng("img/image.png"); $orange = imagecolorallocate($im, 220, 210, 60); $px = (imagesx($im) - 7.5 * strlen($string)) / 2; imagestring($im, 3, $px, 9, $string, $orange); imagepng($im); imagedestroy($im); ?> i also managed to pull some info from my database and have it echo it onto the image. how can i edit the above PHP to put 16 strings onto an image instead of using the 1? if that makes any sense. i want an image, and ontop of that i need to echo 16x pieces of information and i can then figure out how to position these onto the image using co-ordinates. and example image would be: and i understand the image code will be long like; image.php?text=$test1,$test2,$test3 etc..... any help apreciated, first time i used images in this way. Link to comment https://forums.phpfreaks.com/topic/196338-creating-images-using-data/#findComment-1031001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.