Rollover signatures. Please help!
7 posts · 2006-10-26 04:53:31 to 2006-10-27 03:32:24
If you do have the ability to use php then you can use a script such as this:
<?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);
}
}
?>
Which you then place in the same directory as the images you wish to "rotate." Then link to the php script for your sig by pointing to that as the image. Ie <img src="www.example.com/rotate.php">
All that just for a little rotate? Screw that, Ill stick with stanionary ones.
Laters
Then if you only expect to use a common naming pattern such as Sig1.png Sig2.png etc. you could drasitically rewrite the image selection part too. But that "large" script (tiny in caomparison to ones I usually write) is capable of handling any file name and several file types.
thankyou very much chuui for your time and help.. but to be honest i havent a clue as to how and where to do any of that...
i think what i actually meant was i wanted a 'rotator' code simply to randomly go between two different sigs... surely theres a simple bit of code to put in my sig or something that will choose one of two pics randomly?
also i dont seem to have an option to add an avatar 
i think what i actually meant was i wanted a 'rotator' code simply to randomly go between two different sigs... surely theres a simple bit of code to put in my sig or something that will choose one of two pics randomly?
mxoresource do a free rotation service *shrugs* thought you would have known since RMC merged with them and all...
log in, top left corner click settings, then down the bottom you should have 5 input boxes,
insert the URLS to where you uploaded your sigs copy the url it gives to you.
then in your profile you want <img src="http://mxoresource.com/rotator/yourmxoresourceusernamehere/">
/edit about your avatar, you shoudl beable to on the 1st december (1year on forums point)
Yeah there is, the code I listed in this topic =D But things like that are never simple as it requires a server-side language to run it (in this case I used PHP for that) but the SOE servers can't run the script for you, so you need a server that can and will host the images for you. That's pretty much what Resource will be doing, using a script like the one I posted here but with another section of code to work out for who the images need to be fetched (hence the need for your MXOResourcename in the URL).

