0 members and 1,970 guests
No Members online
» Site Navigation
» Stats
Members: 35,443
Threads: 103,072
Posts: 826,684
Top Poster: cc.RadillacVIII (7,429)
|
-
How to get your signature to randomize.
I do not know where to put this, so I will stash it here for now. I have been asked a lot on how I get my signature to randomize like it does, so I will tell you.
First - You need access to a web server with PHP support. This is where you will put all the signatures, and the PHP file to have it all randomize. Upload your images into a folder that will be your randomizing set. [Example - website.com/signature]
Second - Create a PHP file with any name you want, I just went with a simple "image.php" And uploaded it to the folder than images images are in. [Only have images you want randomized in this folder.]
Third - The following code is what should be in the PHP file.
PHP Code:
<?php
$folder = '.'; $extList = array(); $extList['gif'] = 'image/gif'; $extList['jpg'] = 'image/jpeg'; $extList['jpeg'] = 'image/jpeg'; $extList['png'] = 'image/png';
$img = null;
if (substr($folder,-1) != '/') { $folder = $folder.'/'; }
if (isset($_GET['img'])) { $imageInfo = pathinfo($_GET['img']); if ( isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) && file_exists( $folder.$imageInfo['basename'] ) ) { $img = $folder.$imageInfo['basename']; } } else { $fileList = array(); $handle = opendir($folder); while ( false !== ( $file = readdir($handle) ) ) { $file_info = pathinfo($file); if ( isset( $extList[ strtolower( $file_info['extension'] ) ] ) ) { $fileList[] = $file; } } closedir($handle);
if (count($fileList) > 0) { $imageNumber = time() % count($fileList); $img = $folder.$fileList[$imageNumber]; } }
if ($img!=null) { $imageInfo = pathinfo($img); $contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ]; header ($contentType); readfile($img); } else { if ( function_exists('imagecreate') ) { header ("Content-type: image/png"); $im = @imagecreate (100, 100) or die ("Cannot initialize new GD image stream"); $background_color = imagecolorallocate ($im, 255, 255, 255); $text_color = imagecolorallocate ($im, 0,0,0); imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color); imagepng ($im); imagedestroy($im); } }
?>
Forth - Now that the PHP file is done, and all the images are uploaded, how to put this in your signature. Under Signature, put the image tags, and inside of that put the link to the PHP file, as if it was an image.
example -
HTML Code:
[IMG]http://www.website.com/signature/image.php[/IMG]
And you are done. If this is on a website that doesn't allow PHP in a signature like this, just add "/image.jpg" to the end to disguise it as a normal JPEG picture.
example -
HTML Code:
[IMG]http://www.website.com/signature/image.php/image.jpg[/IMG]
Commissions and stickers available via linktree here.
-
YES!! OMG thank you so much, I have been wondering how to do this ever since I saw yours. I'll give this a shot, although I'm not great at coding/webserver stuff.
Originally Posted by MarkPancake
MarkPancake banned.
Success.
-
Awesome! That is So Cool. Do you have any suggestions for websites or servers that may allow you to do this?
If I give is a shot, I may be coming back for help every now and then. Been years since I did some of the advanced coding.
-
thnx alot pet
Similar Threads
-
By Apathy in forum Sigs & Manips
Replies: 1
Last Post: 02-02-2007, 05:46 AM
-
By Freak in forum Sigs & Manips
Replies: 8
Last Post: 09-05-2005, 05:18 PM
-
By Nightfire in forum Sigs & Manips
Replies: 9
Last Post: 09-03-2005, 03:21 PM
-
By Lokiwho in forum Sigs & Manips
Replies: 2
Last Post: 09-02-2005, 12:14 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|