In Gmail just launched the small but really useful feature in Gmail Labs. The number of unread e-mails is displayed directly in the Favicon of your browser tab icon. If your browser window lots and lots are always open to the label, this may really be a fantastic feature to let users know any unread items.
Here is a small and powerful script for PHP that allows you to create your own dynamic favicon. We will use PHP's GD library to manipulate the favicon image and add the text to it.
Here is a simple script to read an icon image to add some text characters.
Files: favicon.php
Read the template of the Favicon favicon.png
Files from the current directory
$im = Imagecreatefrompng ("Favicon.png");
$im = imagecreatefromjpg ("favicon.jpg"); Use this function to load the favicon of a JPEG type
$im = Imagecreatefrombmp ("Favicon.bmp"); Use this function to load a BMP type of Favicon
/* Read characters that need to be added in Favicon
* GET Request
*/
if (Isset ($_get[' char ')) &&!empty ($_get[' char '])) {
$string = $_get[' char '];
} else {
/* If no characters are specified add some default values */
$string = ' V ';
}
/* Background color of the favicon */
$BG = Imagecolorallocate ($im, 255, 255, 255);
/* Foreground (font) color for the favicon */
$black = imagecolorallocate ($im, 0, 0, 0);
/* Write Favicon characters
* arguements: Image, font size, x-coordinate,
* y-coordinate, characterstring, color
*/
Imagechar ($im, 2, 5, 1, $string, $black);
Header (' content-type:image/png ');
Imagepng ($im);
?>
The code above is almost self-explanatory. We request from Get and add the favicon image to a character. Note that here we use a template of the favicon image,
I modified. You can select any favicon near your favicon.php file.
http://www.bkjia.com/PHPjc/477885.html www.bkjia.com true http://www.bkjia.com/PHPjc/477885.html techarticle in Gmail just launched the small but really useful feature in Gmail Labs. The number of unread e-mails is displayed directly in the Favicon of your browser tab icon. If your browser window ...