PDA

View Full Version : PHP GD



Yonder
30-11-2009, 02:25 AM
So im sure im missing something, i have done GD before and i have referred to my previous work but im just missing something im sure of it!


<?PHP


$default_style = '1';

$style = $_GET["style"];
$style = ($style == '') ? $default_style : $style;

$file = 'images/$style.png';
$im = imagecreatefrompng($file);



$white = imagecolorallocate ($im, 255, 255, 255);

$font_file = 'Volter.ttf';

imagefttext($im, 20, 0, 505, 130, $white, $font_file, "HI");


header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>


Basically it works fine except i cannot choose a style it just sticks with the default one!

Calvin
30-11-2009, 03:00 AM
Are you sure you've uploaded all the images?

2.png etc.

Calvin
30-11-2009, 03:36 AM
<?PHP

$default_style = '1';

$style = $_GET["style"];
$style = ($style == '') ? $default_style : $style;

$file = 'images/'.$style.'.png';
$im = imagecreatefrompng($file);



$white = imagecolorallocate ($im, 255, 255, 255);

$font_file = 'Volter.ttf';

imagefttext($im, 20, 0, 505, 130, $white, $font_file, "HI");


header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?> That should work, I think?

then countdown.php?style=1 but replace the 1 with whatever number style you want, you'll have to have 2.png etc. in the images folder.

Sorry for double post btw.

Yonder
30-11-2009, 07:56 PM
'.$style.' seems i missed huh?

New it would be something simple i will try this out when i get home and yes i had all teh 2.png's etc

Thanks alot :) rep+

(have to spread)

GoldenMerc
30-11-2009, 08:12 PM
I dont get how that works, can you explain ? im guessing its to do with your signiture thats on Habbox.com...
Ross

Yonder
30-11-2009, 11:35 PM
Its part of a countdown script :)

GoldenMerc
01-12-2009, 12:02 AM
Yeh i relise that but how does it workkkkkk ;[[[

Yonder
01-12-2009, 12:45 AM
Php script that spits out a png using GD.

Want to hide these adverts? Register an account for free!