I had a little play around with image gd..
PHP Code:<?php
$christmas = mktime(0,0,0,12,25,date("Y")) + 3600; // Finds the timestamp for Christmas at midnight of the current year (Hours,Minutes,Seconds,Months,Days,Year), date("Y") finds the current year
$time = $christmas - time(); //Finds seconds between Christmas at midnight and the time now.
if($time <0) {print("Merry Christmas");} // Prevents errors if it is beyond midnight
else { // Adds an exception
$times = $time % 60; // Finds the number of seconds as a result of finding the remainder of dividing by 60
$time = floor($time / 60); // Effectively removes those seconds from the total by dividing by 60 and then flooring
$timem = $time % 60; // Finds the number of minutes as a result of finding the remainder of dividing by 60
$time = floor($time / 60); // Effectively removes those minutes from the total by dividing by 60 and then flooring
$timeh = $time % 24; // Finds the number of hours as a result of finding the remainder of dividing by 24
$time = floor($time / 24); // The number of hours is the floored value of dividing the number of hours by 24
$text = $time." Days, ".$timeh." Hours, ".$timem." Minutes, ".$times." Seconds.";
//print($text);
}
// The End
// Create a blank image and add some text
$im = imagecreatetruecolor(210, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, $text, $text_color);
// Output the image
//imagegd($im);
header('Content-Type: image/png');
imagepng($im);
// Free up memory
imagedestroy($im);
?>



Reply With Quote
- Click 

