Jump to content

creating images using data


jacko_162

Recommended Posts

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

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:

image_to_use.png

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.