Exploding Garrmondo Weiner Interactive Swiss Army Penis

Exploding Garrmondo Weiner Interactive Swiss Army Penis (http://www.gamingforce.org/forums/index.php)
-   Help Desk (http://www.gamingforce.org/forums/forumdisplay.php?f=36)
-   -   Rotating Sig Images? (http://www.gamingforce.org/forums/showthread.php?t=35760)

Crash "Long-Winded Wrong Answer" Landon Dec 17, 2008 07:10 PM

Rotating Sig Images?
 
I've got access to php-enabled image hosting, so I know I can accomplish this. However, it involves scripting that is beyond my meager comprehension. I've googled the subject but remain confused; most available rotation scripts assume you know how they operate, whereas I'm admittedly not smart in this area.

Could someone please explain the process in enough detail that I might be able to do it myself and learn the processes better?

I've already got the images uploaded to a directory. Do they all need to be contained in one folder? I'm not 100% sure on that part.

Thanks for any help.

Dyesan Dec 17, 2008 07:12 PM

Relevant to my interests!

The unmovable stubborn Dec 17, 2008 07:17 PM

This used to be pretty simple to do back in the old html-enabled days. I've tried to get it going several times, but no dice.

Obviously Chz knows how to finagle this but maybe he's just granted himself html permissions.

Crash "Long-Winded Wrong Answer" Landon Dec 17, 2008 07:23 PM

This may be something I'm capable of too, and could grant to others by request if I knew how.

I'll have to probe deeper into this matter.

Fleshy Fun-Bridge Dec 17, 2008 08:08 PM

Its pretty simply. The premise is this:

You're sig links to the PHP script. The script, in turn, reads a directory of images into an array. It then generates a random number (you can seed with the system clock) and picks that offset in the array. The rest is emitting the MIME headers and then the image data. If you do a bit of googling, you can find numerous sample PHP scripts for rotating images in this fashion. I wrote one myself years ago, and I'm sure its buried somewhere in the depths of my drive but I can't be bothered to look for it...

The unmovable stubborn Dec 17, 2008 08:10 PM

In theory that is precisely how it works, yes.

In practice, GFF just returns a broken img tag.

Zergrinch Dec 17, 2008 08:31 PM

I could've sworn I saw Acerbandit pull this off with his Advice Dog sig

Aardark Dec 17, 2008 08:31 PM

If you don't want to bother with scripting, just use Rotating Signature Host.

http://www.clintonio.com/sig-3806.jpg

Crash "Long-Winded Wrong Answer" Landon Dec 17, 2008 08:39 PM

Quote:

Originally Posted by ElectricSheep (Post 668150)
Its pretty simply. The premise is this:

You're sig links to the PHP script. The script, in turn, reads a directory of images into an array. It then generates a random number (you can seed with the system clock) and picks that offset in the array. The rest is emitting the MIME headers and then the image data. If you do a bit of googling, you can find numerous sample PHP scripts for rotating images in this fashion. I wrote one myself years ago, and I'm sure its buried somewhere in the depths of my drive but I can't be bothered to look for it...

Which is exactly what I've done, and still no image appears. I've tested each individual image url, so I know they're all functional. It's something server-side here and if you don't have a Bachelor's in coding, you are evidently up a certain creek without paddles.

I may give the link Aardark posted a try, though I'm concerned it won't be able to house the number of images I wanted to use.

Fleshy Fun-Bridge Dec 17, 2008 09:06 PM

Okay. How about this. Does my sig rotate for you? (you might have to wait a few seconds before reloading)

Zergrinch Dec 17, 2008 10:03 PM

Your sig doesn't show for me.

Fleshy Fun-Bridge Dec 17, 2008 10:18 PM

Hmm....it shows up here under Safari, Firefox, Chome, and IE 7. Don't know what to tell you. Its not linking to a local host.

Zergrinch Dec 17, 2008 11:24 PM

Please disregard my message. I had set signatures to display only once, and did not notice you had an earlier post.

It's working fine and the image does cycle through. Gimme php script pliss :)

FatsDomino Dec 17, 2008 11:49 PM

Quote:

Originally Posted by Zergrinch (Post 668157)
I could've sworn I saw Acerbandit pull this off with his Advice Dog sig

Yup!

http://www.thegond.com/php/advicedogsig.php

It's pretty freaking easy. All you have to do is edit the php script with the directory name and put the script before the directory and you should be good to go.

Quote:

Originally Posted by So change the line
$file = getRandomImage('./tempsig/');

Change "tempsig" to whatever your directory is called. Yay!


Here's a zip file. Open the php file in notepad.

Jurassic Park Chocolate Raptor Dec 17, 2008 11:57 PM

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);
        }
}

?>

I can't remember where I got this, but I've had it for a while sitting in an old snippets folder. It works with [img] tags. I used it to host Paco's mexican joke sig from a while back.

Forgive me if it's patronizing but I'll be as beginner friendly as possible.

Copy, paste, throw into your favorite text editor, save with a .php extension.

Throw it into the folder full of the images you want to rotate on your host, and then go
[ img]http://www.crashlandon.com/sigs/rotatin/nameofscript.php[/img].

You can add more supported file types to the file type array as long as your mime-type is correct, and you can put this rotator script elsewhere if you change the $folder variable to point to the full path of the folder full of images you want to use.

Edit: See?

http://colonelskills.belkanairforce....sig/rotate.php

OmagnusPrime Dec 18, 2008 08:48 AM

The one problem with most rotating image scripts is that they only work in those instances where you can link to a PHP or script file. I know of a number of forums where sticking [ img ]www.something.whatever/folder/script.php[ /img ] just won't work because the img tags don't like non-image extensions.

There is a way around this, but it requires access to things like the .htaccess file on your webspace.

This is a feature I built into my image host (b3 iHost v1.2.2) when I made it a few years back, and it's what I was using to do my rotating sig image effort recently. It's possibly a bit clunky, because I've not done anything with it for a few years, but it all works quite happily still.

So, a quicker solution, if you fancy it, is that I can hook you up with an account on my image host.

gaming Dec 18, 2008 09:17 AM

I don't know much about scripting either, but what do I have to change in AcerBandit's or Colonel Spreadsheet's code in order to make it to work for images that I have hosted with ImageShack?

OmagnusPrime Dec 18, 2008 09:38 AM

Quote:

Originally Posted by gaming (Post 668335)
I don't know much about scripting either, but what do I have to change in AcerBandit's or Colonel Spreadsheet's code in order to make it to work for images that I have hosted with ImageShack?

First of all you need webspace that can host the script and that supports PHP. If you have that you'll need to update their scripts to create an array of URLs, and use that as the source for images rather than scanning the local directory. If you're not familiar with scripting this is probably going to be somewhat tricky, but I don't have time to sort out the code right now.


All times are GMT -5. The time now is 02:24 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2025, vBulletin Solutions, Inc.