Images for numbers

images php coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
M0n5terBunny
New php-forum User
New php-forum User
Posts: 9
Joined: Tue Sep 06, 2011 2:30 am

Images for numbers

Postby M0n5terBunny » Sat Oct 15, 2011 11:59 am

hello all i have this code

Code: Select all

<html><head>
<title>Numbers</title>



</head><center>


<center><font face=arial><body>

<?php



$n2 = rand(0,100);
$n3 = rand(0,100);
$n4 = rand(0,100);
$n5 = rand(0,100);
$n6 = rand(0,100);
$n7 = rand(0,100);
$n8 = rand(0,100);
$n9 = rand(0,100);
$n10 = rand(0,100);
$number =  ($n2+$n3+$n4+$n5+$n6+$n7+$n8+$n9+$n10);

$v1 = "Voucher";
$v2 = "Free Support ";
$v3 = "a Hug ";
$v4 = "Looser !";

if ( $number > 1 && $number < 20 ) { echo $v1; }
if ( $number > 21 && $number < 40 ) { echo $v2; }
if ( $number > 41 && $number < 60 ) { echo $v3; }
if ( $number > 61 && $number < 999 ) { echo $v4; }


echo "<p>Your number was: $number";
?>




</body></html>


and i was wondering if it was possible to generate numbers and then that number turned into images from several images of numbers, as in 543 would be an image of the number 5, image of number 4 and an image of number 3, i have tried the font but its easier with images i think any ideas ?

NigelRen
php-forum Active User
php-forum Active User
Posts: 450
Joined: Fri Aug 05, 2011 9:53 am

Re: Images for numbers

Postby NigelRen » Mon Oct 17, 2011 2:42 am

If you found some images of numbers ( use google or even generate them yourself using something like GIMP ), save them as something like Number1.jpg, Number2.jpg and then all you need to do is output the corresponding image tags with a reference to these images.

User avatar
M0n5terBunny
New php-forum User
New php-forum User
Posts: 9
Joined: Tue Sep 06, 2011 2:30 am

Re: Images for numbers

Postby M0n5terBunny » Mon Oct 17, 2011 2:48 am

I have some numbers now how would I use them to replace the numbers in my generator isn't there some php code that does if ($number has 5) echo IMg src"5.jpg"/> ?


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 2 guests

cron