Mailinglist Archive: opensuse (2489 mails)

< Previous Next >
Re: [opensuse] Blue Countdown Available
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Mon, 01 Dec 2008 11:48:34 -0600
  • Message-id: <49342372.8070802@xxxxxxxxxxxxxxxxxx>
chen swyear wrote:
Hey! Sylvester and David:
Thank you both.
Those new countdowns look very interesting!
I offical countdown, we can add a ID to use an localized counter.
eg. http://counter.opensuse.org/11.1/small.jp for Japan, and
http://counter.opensuse.org/11.1/small.tw for Taiwan
Would you please to add this function?
I will use it in my blog.
Many thanks.

With Regards
Ray Chen


Ray,

I would be happy to include the Japanese and Taiwanese localized
counter for
you, but I do not know how to do it. Mine is a very simple script that I guess
uses the time in local-time from my server location (CST). If you would like to
download my script (or just cut and past for below) it should work in local
time from your location on your server:

Background Images:

http://www.3111skyline.com/download/openSUSE_11.1/images/counter-small-blue.png
http://www.3111skyline.com/download/openSUSE_11.1/images/counter-medium-blue.png

gd Scripts:

http://www.3111skyline.com/download/openSUSE_11.1/images/countdown-small.php
http://www.3111skyline.com/download/openSUSE_11.1/images/countdown.php

If your blocked from downloading by IP filtering, here are the actual
php
scripts. just cut-n-paste into countdown-small.php and countdown.php,
respectively:

countdown-small.php

<?php
// Create the Base image from a png file
$img = imagecreatefrompng('counter-small-blue.png');
// Set the content-type
header("Content-type: image/png");
// Create some colors
$white = imagecolorallocate($img, 255, 255, 255);
$ltblue = imagecolorallocate($img, 82, 97, 214);
$dkblue = imagecolorallocate($img, 14, 44, 78);
// Calculated the Days to go
// day of year for 12/18/08
$date = new DateTime("18-December-2008 00:00:01");
$reldate=$date->format("z");
//todays day number of the year
$datenow = new DateTime();
$countday = $datenow->format("z");
//Calculation of days to go
$timetogo = $reldate - $countday;
// Select Standard Font
$font = 'DejaVuSans.ttf';
// Draw the date
$text = $timetogo;
// Add some shadow to the text
imagettftext($img, 42, 0, 29, 93, $ltblue, $font, $text);
// Add the text
imagettftext($img, 42, 0, 28, 91, $white, $font, $text);
// Draw days to go shadow and text
$font = 'DejaVuSans-Bold.ttf';
$text = 'days to go';
imagettftext($img, 12, 0, 19, 116, $ltblue, $font, $text);
imagettftext($img, 12, 0, 18, 115, $white, $font, $text);
// Draw the Image and Cleanup
imagepng($img);
imagedestroy($img);
?>

countdown.php

<?php
// Create the Base image from a png file
$img = imagecreatefrompng('counter-medium-blue.png');
// Set the content-type
header("Content-type: image/png");
// Create some colors
$white = imagecolorallocate($img, 255, 255, 255);
$ltblue = imagecolorallocate($img, 82, 97, 214);
$dkblue = imagecolorallocate($img, 14, 44, 78);
// Calculated the Days to go
// day of year for 12/18/08
$date = new DateTime("18-December-2008 00:00:01");
$reldate=$date->format("z");
//todays day number of the year
$datenow = new DateTime();
$countday = $datenow->format("z");
//Calculation of days to go
$timetogo = $reldate - $countday;
// Font path
$font = 'DejaVuSans.ttf';
// The date to draw
$text = $timetogo;
// Add some shadow to the text
imagettftext($img, 84, 0, 59, 188, $ltblue, $font, $text);
// Add the text
imagettftext($img, 84, 0, 57, 185, $white, $font, $text);
// The title to draw
$text = 'days to go';
// Add some shadow to the text
imagettftext($img, 22, 0, 47, 226, $ltblue, $font, $text);
// Add the text
imagettftext($img, 22, 0, 46, 225, $white, $font, $text);
// Draw the Image and Cleanup
imagepng($img);
imagedestroy($img);
?>

--
David C. Rankin, J.D.,P.E. | openSoftware und SystemEntwicklung
Rankin Law Firm, PLLC | Countdown for openSuSE 11.1
www.rankinlawfirm.com | http://counter.opensuse.org/11.1/small
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >