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.
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.
My script has content-type.deimos said:bah, no one cares about content-type
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.
#! /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);
}
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.Graham Hood said:I thanked you above for the script, works great
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?