Creating an image from a URL with a MySQL record

Hello,

I’m trying to create an image to display depending on the number recorded in MySQL.

The images are named in numerical order, for example google.com/img/img_1.png, google.com/img/img_2.png. I want to create it so that it changes the number of the image to the users record, but I have no idea what sort of function I should be using.

I have been using imagecreatefrompng and imagettftext to turn user records into an image. As I’m using imagecreatefrompng as the background image, how can I display another smaller image on top of the background image with what I described above.

[php]
header(‘Content-Type: image/png;’);
$im = @imagecreatefrompng(‘http://i.imgur.com/S47dP3u.png’) or die(“Cannot select the correct image. Please contact the webmaster.”);
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);

$UserID=mysql_result($result,0,“UserID”);
$Username=mysql_result($result,0,“Username”);

$text_id = “$UserID”;
$text_username = “$Username”;

imagettftext($im, 13, 0, 185, 40, $text_color, $font, $text_id);
imagettftext($im, 10, 0, 185, 60, $text_color, $font, $text_username);
[/php]

Just a question, but why are you creating the image of the text, instead of just using the text?

Because I like the user to be able to use the image in other places without having to copy and paste all the text, specifically image tags to be used in a forum or webpage.

Sponsor our Newsletter | Privacy Policy | Terms of Service