Jump to content
  • Sign up now

    Registration is quick and easy 

countdown sigs


mealexme
 Share

Recommended Posts

just write one in php using gd2.0 and upload it to freewebs. that's what i did when i had one! 30 min job, if that.

 

I read this after reading your thread about your mum with computers.

Then felt just like your Mum :( Age is a horrible thing.

Link to comment
Share on other sites

Here you go, I found the code I wrote - I put it on limedomains not freewebs (my mistake!)


Anyway, it would seem that limedomains was sold to a bunch of incompetents and has since gone bust, so just do a google search for "free PHP hosting" and modify the following script as you require. The bits you'll need to change are indicated by *** ... *** comments. It's not difficult to figure it out with a bit of help from Google even if you're not a programmer. :thumb:

 

<?php

//Create the image resource.
$im = @imagecreate(400, 30)  // *** INCREASE THE VALUE OF THE SECOND PARAMETER FOR LONGER MESSAGES ***
or die("Cannot Initialize new GD image resource");

//Derestriction date and difference from now.
$derestime = mktime(0, 0, 0, 3, 23, 2011);  //23-03-11 *** MODIFY THE COUNTDOWN DATE HERE ***

$difftime = $derestime - time();
$months = date("m", $difftime);
$days = date("j", $difftime);;

// *** CONSTRUCT THE MESSAGE TO BE DISPLAYED ***
$remmsg = ">>> ".$months." months, ".$days." days to derestriction! <<<";

//Randomise the colour scheme.
$col[0] = rand(0, 255);
$col[1] = 255 - $col[0];
$col[2] = rand(127, 255);

shuffle($col);
list($red, $green, $blue) = $col;

$text_color = imagecolorallocate($im, $red, $green, $blue);

//Set the background colour.
$rect_color = imagecolorallocate($im, 0x66, 0x66, 0x66);

//Draw the image.
imagesetthickness($im, 2);
imagerectangle($im, 0, 0, 399, 29, $rect_color);
imagestring($im, 5, 6, 7, $remmsg, $text_color);

//Write the image as a PNG to STDOUT.
header("Content-type: image/png");
imagepng($im);

//Clean up.
imagecolordeallocate($text_color);
imagecolordeallocate($rect_color);
imagedestroy($im);

?>

Link to comment
Share on other sites

It's not OO - imagecolordeallocate is a function that requires a resource that is returned by imagecolorallocate. (GD was written long before PHP became OO).


But ... Ooops! I made an error there - it's obviously a back up file that I copied from by mistake - you need to pass $im as the first arg and the colour resource as the second arg.


imagecolordeallocate($im, $text_color);

imagecolordeallocate($im, $rect_color);


That should do the trick!


What is arboresence? I have never heard of it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Terms of Use Privacy Policy Guidelines 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.