There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
blue screen blue screen of death boot computer connection crash css dell display driver drivers email error ethernet excel firefox firefox 3 hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking nvidia outlook outlook 2003 outlook express partition password printer problem problems router security slow software sound trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Random Image Displayer Help


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
DarkSeveranc's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2003
28-Jun-2003, 01:40 PM #1
Random Image Displayer Help
I've been wrestling with this for awhile and what should be something simple for some reason has been eluding me. I have tried multiple types of random image generators but can't seem to get any of them to work. My latest one has been rand_image.pl.

Code:
#! /usr/local/bin/perl
##############################################################################
# Basic Random Image Displayer  Version 1.2                                  # 
# Copyright 1996 Matt Wright    mattw@scriptarchive.com                      #
# Created 7/1/95                Last Modified 7/20/95                        #
# Scripts Archive at:           http://www.scriptarchive.com/                #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1996 Matthew M. Wright  All Rights Reserved.                     #
#                                                                            #
# Basic Random Image may be used and modified free of charge by anyone so    #
# long as this copyright notice and the comments above remain intact.  By    #
# using this this code you agree to indemnify Matthew M. Wright from any     #
# liability that might arise from it's use.                                  #  
#                                                                            #
# Selling the code for this program without prior written consent is         #
# expressly forbidden.  In other words, please ask first before you try and  #
# make money off of my program.                                              #
#                                                                            #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium.  In all cases copyright and header must remain intact.#
##############################################################################
# Necessary Variables
  $basedir = "http://www.protoculturex.com";
  @files = ("cornerpic.jpg","cornerpic2.jpg");

# Options
  $uselog = 0; # 1 = YES; 0 = NO
        $logfile = "/home/protocul/public_html/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 placed this in my cgi-bin. According to what I've read basedir was my URL and files were the actual files being used. I've tried putting this in the same directory as the pictures as well as the cgi-bin and still no go. I've made sure they are chmod at 755 and still same thing, nothing.

The code used for the actual image was supposed to be the path for the script
Code:
< img src="http://www.protoculturex.com/cgi-bin/rand_image.pl" >

The instructions are:
This is the main file and the one that is called upon every time your page is loaded. You will need to place this file in your server's cgi-bin and give users the permission to read/execute this file. (chmod 755 or chmod a+rx) There are also several variables you will have to define:


Necessary Variables


$basedir = "";
This is the http address and base directory that your pictures are placed in. This is in url form. The filenames you specify will be appended to this address. Examples Below.

@files = ("","");
These are all of your files placed into array. The filenames should be reflective of the location of the files relative to your $basedir. Examples Below.


So what am I doing wrong? Any help would be appreciated. Thank you.
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
28-Jun-2003, 01:46 PM #2
Try putting a slash at the end of your base directory.

$basedir = "http://www.protoculturex.com/";
DarkSeveranc's Avatar
Junior Member with 2 posts.
 
Join Date: Jun 2003
28-Jun-2003, 01:55 PM #3
I can't believe it but that worked. I swear I tried that already. Thank you so much!
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
28-Jun-2003, 02:00 PM #4
HexStar's Avatar
HexStar
Guest with n/a posts.
 
30-Jun-2003, 08:29 PM #5
Where'd you get that image?

HexStar
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
30-Jun-2003, 08:38 PM #6
They are built into TSG, i cant find the thread with a list of em though It was by Davey or Mike, and I think it was in Site Comments/Suggestions.
HexStar's Avatar
HexStar
Guest with n/a posts.
 
30-Jun-2003, 08:41 PM #7
Kewl!

Thanks for the reply brendandonhu,

HexStar
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:44 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.