in Gmail just launched a small but really useful feature in Gmail Labs. The number of unread emails is displayed directly in the dynamic favicon of your browser tab icon. If your browser window lots and lots are open at any time, this may really be a fantastic feature that lets users know about any unread items.
Here is a small, 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.
The following is a simple script that reads an icon image to add some text characters.
File: favicon.php
<?php
//Read favicon favicon.png templates
//files from the current directory
$im = imagecreatefrompng ("Favicon.png");
//$im = Imagecreatefromjpg ("favicon.jpg"); Use this function to load the Favicon
//$im = Imagecreatefrombmp ("Favicon.bmp") of the JPEG type;////Use this function to load a BMP type of Favicon
/* Read characters , you need to add a
* GET request
*/
if (isset ($_get[' char ']) &&!empty ($_get[' char ']) in Favicon {
$string = $_get[' Char '];
} else {
/* If no characters are specified to add some default values */
$string = ' V ';
}
/* favicon background color */
$BG = imagecolorallocate ($im, 255, 255, 255);
/* Foreground (font) color for the favicon */
$black = imagecolorallocate ($im, 0, 0, 0);
/* Write Favicon characters
* arguements: Images, font size, x coordinates,
* y coordinates, characterstring, color
*/
Imagechar ($im, 2, 5, 1, $string, $b lack);
Header (' content-type:image/png ');
Imagepng ($im);
The code above is almost self-explanatory. We add the favicon image to a character from Get request. Note that here we use a template for the favicon image,
I modify. You can select any favicon near your favicon.php file.