Rollover signatures. Please help!

7 posts · 2006-10-26 04:53:31 to 2006-10-27 03:32:24

#36300080936 10/26/2006 04:53:31 Rollover signatures. Please help!
whats the code to implement two sigs to 'rollover' as they say i think..   any help much appreciated! adios!
#36300080970 10/26/2006 05:06:13 Re:Rollover signatures. Please help!
You'll need a php script and a server capable of running php. I don't think imageshack supports php as it just allows you to upload images, so you'll need your own website/domain that does allow the use of php. Unfortunately there are very very few such services that offer php for free.

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">
#36300080990 10/26/2006 05:28:28 Re:Rollover signatures. Please help!

All that just for a little rotate? Screw that, Ill stick with stanionary ones.

Laters

#36300081012 10/26/2006 05:47:12 Re:Rollover signatures. Please help!
Well if you want to use a variety of different image types then the script needs to distinguish file extensions, but if you only use one type you could certainly cut most of that code out. If you don't expect to ever have any errors, you can cut another large chunk out.

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.
#36300081711 10/27/2006 02:32:09 Re:Rollover signatures. Please help!

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 SMILEY

#36300081731 10/27/2006 03:12:21 Re:Rollover signatures. Please help!
452x5 wrote:

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)

Photobucket
#36300081749 10/27/2006 03:32:24 Re:Rollover signatures. Please help!
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?

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).