Dynamic Signature

This is my latest project, making a dynamic signature.

Try to refresh this page and you will notice that the text in this signature changes.To create a dynamic image like this, you’ll need a server to host php file and images. I’m using my blogeek.net. The idea in creating dynamic image is to get image filenames to run as php.

The first thing to do is to create a redirect link for your image. The simplest way is to use the cpanel’s redirect futures.

redirect

You can also create a .htaccess file and insert this code:

Redirect /project/sig/image.png http://blogeek.net/project/sig/i.php

By doing so, when I link the image to forum or discussion board, it will send a request to blogeek.net, and blogeek.net will redirect to i.php.

Take note that there’s NO image.png file in sig folder.

The main part here is the i.php file, where I’ll load the image. Now let’s start coding.

header("Content-type: image/png");
$Random = rand(1,3);
switch ($Random) {
case "1":
$image = imagecreatefrompng("image1.png");
break;
case "2":
$image = imagecreatefrompng("image2.png");
break;
case "3":
$image = imagecreatefrompng("image3.png");
break;
}
imagepng($image);
imagedestroy($image);
?>

This code will randomly choose 3 images and display it. You need to create 3 images and put it in the same folder as the php file. In this case, i.php.

You can also make the php code to write text on your image. Use this code.

imagestring ( resource image, int font, int x, int y, string s, int col )

If you hate coding then you can just download this package. Feel free to customize it.