Random photo on site

Discussion in 'HTML' started by ©®, Jul 14, 2003.

  1. ©®

    ©® Guest

    Every week I do a bulletin of news for our intranet and add a new
    picture and delete the one that was there. Ideally I would like to have
    a directory of pictures and then let it sequentially go through the list
    and change it each time someone loads/refreshes a page.

    How do I do this. (I might have about 100 pictures). Am using DWeaver MX
    and it is a simple html intranet. Many people who are on the intranet
    have old computers so it would be nice to take their situation into
    account if at all possible!
    Thanks
     
    ©®, Jul 14, 2003
    #1
    1. Advertising

  2. On Mon, 14 Jul 2003 23:09:19 +0100, ©® wrote:

    > Ideally I would like to have
    > a directory of pictures and then let it sequentially go through the list
    > and change it each time someone loads/refreshes a page.


    If you are using Apache 2, then look into mod_variety.

    From the package description: "mod_variety is an Apache 2.x module that
    will serve a random file from the requested directory. It is useful for
    serving random images or completely random sites."

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
     
    Toby A Inkster, Jul 14, 2003
    #2
    1. Advertising

  3. On Mon, 14 Jul 2003 23:44:16 +0100, ©® wrote:

    > Toby A Inkster wrote:
    >> If you are using Apache 2, then look into mod_variety.

    > <smip>
    >
    > Er... how do I know that?


    By looking at the HTTP headers. But if you don't already know this, you're
    probably not in the position to install mod_variety.

    > All I do is change html file and upload using FTP program.
    > Is there a script I can use?


    I'm sure there are several decent PHP/CGI scripts for random images. Find
    out what server-side scripting languages your server supports.

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
     
    Toby A Inkster, Jul 14, 2003
    #3
  4. ©®

    floortje Guest

    "©®" <> schreef in bericht
    news:3f13299f$0$45178$...
    > Every week I do a bulletin of news for our intranet and add a new
    > picture and delete the one that was there. Ideally I would like to have
    > a directory of pictures and then let it sequentially go through the list
    > and change it each time someone loads/refreshes a page.
    >
    > How do I do this. (I might have about 100 pictures). Am using DWeaver MX
    > and it is a simple html intranet. Many people who are on the intranet
    > have old computers so it would be nice to take their situation into
    > account if at all possible!
    > Thanks
    >


    easiest way would be to write a small upload script and insert the names
    into a database.
    im assuming u got a .htraccess protected zone somwhere where unly u can come
    out and play

    databasename foto
    field varchar 50 name foto
    dont forget to chmod ur upload folder

    <?php
    include("db.php"); // contains mysql connection + error checking

    if ($_POST["action"]=="new"){
    $destination="../foto"; //whatever
    if ($foto <> "none"){copy($foto,$destination."/".$foto_name);}else{
    echo "er is geen foto ontvangen, ga terug en voer een foto in";exit;}
    mysql_query("INSERT INTO foto
    (`foto`)
    VALUES ('$foto_name')
    ")or die("Query1 failed");
    header("Location: http://thispage.com"); // dont like post data hanging
    around
    exit;
    }else {?>
    <form action="index.php" method="post" enctype="multipart/form-data"
    name="form1">
    <input name="action" type="hidden" id="action" value="new">
    <p class="standaard">Foto<br>
    <input type="file" name="foto">
    </p>
    <input type="submit" name="Submit" value="verstuur">
    </form>
    <?php } ?>

    and to call the pic inser this somewhere
    <?php
    include("db.php"); // contains mysql connection + error checking
    $query = mysql_query("SELECT foto FROM foto ORDER BY RAND() limit 1;");
    $row = mysql_fetch_array($query);
    echo "<img src=\"$row[foto]\" width=\"200\"><html>";
    ?>
     
    floortje, Jul 15, 2003
    #4
  5. ©®

    floortje Guest

    "floortje" <> schreef in bericht
    news:3f147404$0$155$4all.nl...
    >
    > "©®" <> schreef in bericht
    > news:3f13299f$0$45178$...
    > > Every week I do a bulletin of news for our intranet and add a new
    > > picture and delete the one that was there. Ideally I would like to have
    > > a directory of pictures and then let it sequentially go through the list
    > > and change it each time someone loads/refreshes a page.
    > >
    > > How do I do this. (I might have about 100 pictures). Am using DWeaver MX
    > > and it is a simple html intranet. Many people who are on the intranet
    > > have old computers so it would be nice to take their situation into
    > > account if at all possible!
    > > Thanks
    > >

    >
    > easiest way would be to write a small upload script and insert the names
    > into a database.
    > im assuming u got a .htraccess protected zone somwhere where unly u can

    come
    > out and play
    >
    > databasename foto
    > field varchar 50 name foto
    > dont forget to chmod ur upload folder
    >
    > <?php
    > include("db.php"); // contains mysql connection + error checking
    >
    > if ($_POST["action"]=="new"){
    > $destination="../foto"; //whatever
    > if ($foto <> "none"){copy($foto,$destination."/".$foto_name);}else{
    > echo "er is geen foto ontvangen, ga terug en voer een foto in";exit;}
    > mysql_query("INSERT INTO foto
    > (`foto`)
    > VALUES ('$foto_name')
    > ")or die("Query1 failed");
    > header("Location: http://thispage.com"); // dont like post data hanging
    > around
    > exit;
    > }else {?>
    > <form action="index.php" method="post" enctype="multipart/form-data"
    > name="form1">
    > <input name="action" type="hidden" id="action" value="new">
    > <p class="standaard">Foto<br>
    > <input type="file" name="foto">
    > </p>
    > <input type="submit" name="Submit" value="verstuur">
    > </form>
    > <?php } ?>
    >
    > and to call the pic inser this somewhere
    > <?php
    > include("db.php"); // contains mysql connection + error checking
    > $query = mysql_query("SELECT foto FROM foto ORDER BY RAND() limit 1;");
    > $row = mysql_fetch_array($query);
    > echo "<img src=\"$row[foto]\" width=\"200\"><html>";
    > ?>

    Oops thought I was posting in alt.php ... sry
     
    floortje, Jul 15, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RC
    Replies:
    2
    Views:
    488
    John M Deal
    Nov 24, 2004
  2. Lars-Erik Aabech
    Replies:
    8
    Views:
    857
    Lars-Erik Aabech
    Apr 28, 2005
  3. carolyn
    Replies:
    10
    Views:
    815
    dorayme
    Jan 2, 2006
  4. globalrev
    Replies:
    4
    Views:
    782
    Gabriel Genellina
    Apr 20, 2008
  5. VK
    Replies:
    15
    Views:
    1,210
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page