Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Random photo on site

Reply
Thread Tools

Random photo on site

 
 
Guest
Posts: n/a
 
      07-14-2003
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


 
Reply With Quote
 
 
 
 
Toby A Inkster
Guest
Posts: n/a
 
      07-14-2003
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 | (E-Mail Removed) | pgp:0x6A2A7D39
aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:(E-Mail Removed)
http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
playing://(nothing)
 
Reply With Quote
 
 
 
 
Toby A Inkster
Guest
Posts: n/a
 
      07-14-2003
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 | (E-Mail Removed) | pgp:0x6A2A7D39
aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:(E-Mail Removed)
http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
playing://(nothing)
 
Reply With Quote
 
floortje
Guest
Posts: n/a
 
      07-15-2003

"" <(E-Mail Removed)> schreef in bericht
news:3f13299f$0$45178$(E-Mail Removed) ...
> 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>";
?>


 
Reply With Quote
 
floortje
Guest
Posts: n/a
 
      07-15-2003

"floortje" <(E-Mail Removed)> schreef in bericht
news:3f147404$0$155$(E-Mail Removed)4all. nl...
>
> "" <(E-Mail Removed)> schreef in bericht
> news:3f13299f$0$45178$(E-Mail Removed) ...
> > 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
Random "The IListSource does not contain any datasources" and more (Crashing a live site at random, twice a week or so) Lars-Erik Aabech ASP .Net 8 04-28-2005 07:52 AM
photo noise - a new random photo viewing site ssread@gmail.com Digital Photography 5 02-09-2005 01:55 PM
Random NOt random? Darren Clark ASP .Net 3 06-24-2004 05:23 PM



Advertisments