Blackie/Data/Others: Sig Question

PoorDoggy

Veteran XV
How do I configure my signature picture to be different on each refresh? I have more ferrets and since I can't have a sig that spans the entire width of my post (why the fuck not?) I am changing my style.
 
scud nobody else can have a sig like yours.

you are a tribalwar landmark. or benchmark. or watermark.

...marky mark.
 
PHP script that fopens the randomly selected image and forwards the data stream to the image request.
 
Same thing. I can access the PHP script via web browser, I can access the image files, but when I link the script it just red Xs.
 
houston said:
Code:
<?php 

//directory here (relative to script) 
$path = 'sigs'; 

$i = 0; 
$imgDir = opendir ($path); 
    while ( $file = readdir( $imgDir ) ) 
    {     
        //checks that file is an image 
        $file_type = strrchr( $file, "." ); 
        $is_image = eregi( "jpg|gif",$file_type ); 
         
        if ( $file != '.' && $file != '..' && $is_image ) 
        { $images[$i++] = $file; } 
    } 
closedir ($imgDir); 

srand( (double) microtime()*1000000 ); 
$image_name = $path . '/' . $images[rand( 0,sizeof( $images ) -1 )]; 
$imgSize = GetImageSize( $image_name ); 

//ends script if no images found 
if ( $i == 0 ) 
    die(); 

//Display the image 
readfile("$image_name"); 

?>

paste that into a text file and save it as something.php. Then place it on your webserver. In the same folder, create a new folder named sigs. Place all of your sigs in that folder. On tw, make your sig [.img]http://yoursite.com/something.php[./img] without the periods.

Thanks much Houston :bigthumb:
 
houston said:
Code:
<?php 

//directory here (relative to script) 
$path = 'sigs'; 

$i = 0; 
$imgDir = opendir ($path); 
    while ( $file = readdir( $imgDir ) ) 
    {     
        //checks that file is an image 
        $file_type = strrchr( $file, "." ); 
        $is_image = eregi( "jpg|gif",$file_type ); 
         
        if ( $file != '.' && $file != '..' && $is_image ) 
        { $images[$i++] = $file; } 
    } 
closedir ($imgDir); 

srand( (double) microtime()*1000000 ); 
$image_name = $path . '/' . $images[rand( 0,sizeof( $images ) -1 )]; 
$imgSize = GetImageSize( $image_name ); 

//ends script if no images found 
if ( $i == 0 ) 
    die(); 

//Display the image 
readfile("$image_name"); 

?>

paste that into a text file and save it as something.php. Then place it on your webserver. In the same folder, create a new folder named sigs. Place all of your sigs in that folder. On tw, make your sig [.img]http://yoursite.com/something.php[./img] without the periods.

Thanks Houston :bigthumb:
 
houston said:
Code:
<?php 

//directory here (relative to script) 
$path = 'sigs'; 

$i = 0; 
$imgDir = opendir ($path); 
    while ( $file = readdir( $imgDir ) ) 
    {     
        //checks that file is an image 
        $file_type = strrchr( $file, "." ); 
        $is_image = eregi( "jpg|gif",$file_type ); 
         
        if ( $file != '.' && $file != '..' && $is_image ) 
        { $images[$i++] = $file; } 
    } 
closedir ($imgDir); 

srand( (double) microtime()*1000000 ); 
$image_name = $path . '/' . $images[rand( 0,sizeof( $images ) -1 )]; 
$imgSize = GetImageSize( $image_name ); 

//ends script if no images found 
if ( $i == 0 ) 
    die(); 

//Display the image 
readfile("$image_name"); 

?>

paste that into a text file and save it as something.php. Then place it on your webserver. In the same folder, create a new folder named sigs. Place all of your sigs in that folder. On tw, make your sig [.img]http://yoursite.com/something.php[./img] without the periods.

:) I thanked you above for the script, works great :bigthumb:
One question, if I may
What modifications to the script are required to display images in a particular sequence
IE: image01, image02, image03, etc, like a slideshow that shows the next image in the sequence when you do a refresh?
Or does it require too much scripting?
 
Mine is a simple Perl script that runs as CGI. It's only about 10 lines of code.
 
Code:
#! /usr/local/bin/perl
# Necessary Variables
  $basedir = "http://your.host.xxx/images/";
  @files = ("first_image.gif","test.gif","random.gif","neat.jpg");

# Options
  $uselog = 0; # 1 = YES; 0 = NO
        $logfile = "/home/mattw/public_html/image/pics/piclog";

# Done
##############################################################################

srand(time ^ $$);
$num = rand(@files); # Pick a Random Number

# Print Out Header With Random Filename and Base Directory
print "Location: $basedir$files[$num]\n\n";

# Log Image
if ($uselog eq '1') {
    open (LOG, ">>$logfile");
    print LOG "$files[$num]\n";
    close (LOG);
}

I took out the gay copyright notice.
http://poconos.net/scripts/rand_image/rand_image.pl
 
Last edited:
Graham Hood said:
:) I thanked you above for the script, works great :bigthumb:
One question, if I may
What modifications to the script are required to display images in a particular sequence
IE: image01, image02, image03, etc, like a slideshow that shows the next image in the sequence when you do a refresh?
Or does it require too much scripting?
You'd have to have some way to keep track of the image last displayed. That means either tracking IP or using cookies, or some other method along those lines.
 
Back
Top