PDA

View Full Version : Bored Again. Another random PHP signature



timROGERS
05-03-2006, 05:15 PM
Yes, it's Tim's bored time again! This time I made a random signature that gets whether it is AM and displays accordingly :P

If you want it the URL is http://www.lolz.co.uk/greetings/bar.php. If you wanna host it yourself/customize it, here is the code:


<?php
header("Content-type: image/png");
$am_pm = date('a');
if ($am_pm == "am")
$message = "Good morning!";
else {
$message = "Good evening!";}
$im = imagecreatefrompng("template.png");
$textcolour = imagecolorallocate($im, 0, 0, 0);
$font = "verdana.ttf";
imagettftext($im, 10, 0, $x, $y, $textcolour, $font, $message);
imagepng($im);
?>

You'll need to upload your template file and the verdana font file.

Flisker
05-03-2006, 05:31 PM
Cool :) but how you ad dit into your siggy :S

EDIT: found out :)

timROGERS
05-03-2006, 05:32 PM
It's just an image :P Put it like you would a normal image!

Flisker
05-03-2006, 05:33 PM
thanks :)

Id love to learn PHP ive been trying for ages -.-

:Edzy
05-03-2006, 05:45 PM
lol its great i dont know how 2 do this stuff:( why not make a tutorial :)

nets
05-03-2006, 05:56 PM
lol its great i dont know how 2 do this stuff:( why not make a tutorial :)
Learn basic PHP and how to use the image editing functions; then just create a message which defines evening or morning, which is as easy as:

$msg = 'Good morning.';
if (date('a')!='am') $msg = 'Good evening.';

:Edzy
05-03-2006, 06:12 PM
well i'm rubbish at that coz i just cant take it in :(

:Edzy
05-03-2006, 07:06 PM
Hey I stole all your files and it wont work, it says error on line 11

and nor duz ur othr cool 1 can u zip them and upload the zips of all the things needed?

also is it possible to do:

Good Morning
Bon Appetit (for lunchtime)
Good Afternoon
Good Evening
Good Night

nets
05-03-2006, 07:30 PM
Hey I stole all your files and it wont work, it says error on line 11

and nor duz ur othr cool 1 can u zip them and upload the zips of all the things needed?

also is it possible to do:

Good Morning
Bon Appetit (for lunchtime)
Good Afternoon
Good Evening
Good Night
Perhaps it's because he didn't declare two of the variables (x and y)? I can't test that theory as I've got an old version of PHP on this computer.

Bomb-Head
05-03-2006, 11:10 PM
hah nice.

Flisker
06-03-2006, 06:55 AM
/\ I think he was meant to say Aha
l

JoeyK.
06-03-2006, 09:24 AM
I like that x] A little different, but still fun.

Php
06-03-2006, 11:05 AM
cooool =]

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