39 users online (1 members and 38 guests)  

Thread: random image


  Results 1 to 4 of 4

Related

  1. Random Image/Member/Forum topic    Forum: PHP Forum
    Replies: 1
  2. Random Image Problem    Forum: Javascript Forum
    Replies: 3
  3. Replies: 2
  4. random sponsors    Forum: HTML Forum
    Replies: 1
  5. Random Pic Javascript    Forum: Javascript Forum
    Replies: 1
  1. #1
    pabloj24's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    1

    random image

    Hi, i'm trying to display a set of random images on a web page useing perl. I have a folder containing about 100 pics and want to display 5 at a time in a row.... however i can not get the script to display different images (no repeats). all 5 pics are always identical.
    On the web page I am posting:
    Code:
    <img src = "/cgi/random.pl">
    <img src = "/cgi/random.pl">
    <img src = "/cgi/random.pl">
    <img src = "/cgi/random.pl">
    <img src = "/cgi/random.pl">
    My perl file random.pl is as follows:
    Code:
    #!/usr/bin/perl -w
    $MAX = 9;
    $SERVER = "moc.etisbewym.www//:ptth"
    $DIR = "/bannerimages";
    $FILE = "banner";
    $EXT = "jpg";
    srand (time^$$);
    $index = int (rand ($MAX));
    print "Location: $SERVER/$DIR/$FILE$index.$EXT\n\n";
    exit (0);
    Thanks
    Last edited by DeadMeatGF; 04-17-2007 at 06:34 AM. Reason: Added Code tags

  2. #2
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: random image

    Post your full code if you can. Because that section WILL NOT print a random image. I know of a much much much shorter and better method. But I want to see your full code first, then I can help you with it (I also do the same thing on one of my websites)

  3. #3
    xmassey's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Apr 2007
    Posts
    100

    Re: random image

    Sorry, I read your code properly lol, and I still want to see all the my staements etc, just I can't see how you get "banner", wheres your file opening code?

  4. #4
    Seymour Clufley's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2008
    Posts
    1

    Re: random image

    XMassey, would you mind showing "shorter and better" method you mentioned? I for one would be grateful.



Tags for this Thread