note 71788 added to function.imagefilledrectangle
| From: | Google at osu1 dot php dot net | Date: | Fri, 15 Dec 2006 21:35:51 +0000 |
| Subject: | note 71788 added to function.imagefilledrectangle | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120643@lists.php.net to get a copy of this message | ||
<?php
//index.php
//set your year, month, daym hour, minute, second you want to cuuntdown to.
//ONLY CHANGE FROM HERE
$year="2006";
$month="12";
$day="25";
$hour="00";
$minute="00";
$second="00";
$event="Christmas Day 2006";
$time=mktime($hour, $minute, $second, $month, $day, $year);
$timecurrent=date('U');
$cdtime=$time-$timecurrent;
$cdmonths=$cddays/30;
$cdyears=$cddays/365;
//Used this case only...
$cdminutes=round($cdtime/60);
//cdtime is seconds
$cdhours=round($cdtime/3600);
$cddays=round($cdhours/24);
//String the date
$currentdate = date('l, F j, Y');
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = imagecreatetruecolor(701, 355);
//Temp BGCOLOR (center of c-finder)
$bg1 = 208;
$bg2 = 130;
$bg3 = 208;
$s1 = $bg1 - 20;
$s2 = $bg2 - 20;
$s3 = $bg3 - 20;
$t1 = $bg1 + 30;
$t2 = $bg2 + 30;
$t3 = $bg3 + 30;
$cArray=array();
$c1 = imagecolorallocate($im, $bg1, $bg2, $bg3); //Background
$c8 = imagecolorallocate($im, 255, $bg2, 255); //Background
$c2 = imagecolorallocate($im, $s1, $s2, $s3); //Shadow
$c3 = imagecolorallocate($im, $t1, $t2, $t3); //Text
imagefilledrectangle($im, 0, 0, 701, 50, $c1);
imagefilledrectangle($im, 0, 0, 701, 50, $c8);
// The text to draw
$text = $string;
// Replace path by your own font path
$fnum = rand(1, 9);
$font = "/f/font ($fnum)";
// Add some shadow to the text
imagettftext($im, 29, 1, 17, 42, $c2, $font, "Today is:");
imagettftext($im, 28, -1, 15, 40, $c3, $font, "Today is:");
imagettftext($im, 29, 1, 17, 92, $c2, $font, "...$currentdate...");
imagettftext($im, 28, -1, 15, 90, $c3, $font, "...$currentdate...");
imagettftext($im, 29, 1, 17, 142, $c2, $font, "So there are exactly:");
imagettftext($im, 28, -1, 15, 140, $c3, $font, "So there are exactly:");
imagettftext($im, 29, 1, 17, 192, $c2, $font, "$cddays with just...");
imagettftext($im, 28, -1, 15, 190, $c3, $font, "$cddays days with just...");
imagettftext($im, 29, 1, 17, 242, $c2, $font, "$cdminutes minutes and only...");
imagettftext($im, 28, -1, 15, 240, $c3, $font, "$cdminutes minutes and only...");
imagettftext($im, 29, 1, 17, 292, $c2, $font, "$cdseconds seconds until...");
imagettftext($im, 28, -1, 15, 290, $c3, $font, "$cdseconds seconds until...");
imagettftext($im, 29, 1, 17, 342, $c2, $font, "- + $event + -");
imagettftext($im, 28, -1, 15, 340, $c3, $font, "- + $event + -");
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
----
Server IP: 216.194.113.175
Probable Submitter: 24.253.105.14
----
Manual Page -- http://www.php.net/manual/en/function.imagefilledrectangle.php
Edit -- https://master.php.net/note/edit/71788
Del: integrated -- https://master.php.net/note/delete/71788/integrated
Del: useless -- https://master.php.net/note/delete/71788/useless
Del: bad code -- https://master.php.net/note/delete/71788/bad+code
Del: spam -- https://master.php.net/note/delete/71788/spam
Del: non-english -- https://master.php.net/note/delete/71788/non-english
Del: in docs -- https://master.php.net/note/delete/71788/in+docs
Del: other reasons-- https://master.php.net/note/delete/71788
Reject -- https://master.php.net/note/reject/71788
Search -- https://master.php.net/manage/user-notes.php