Random pictures display

M

Marcin Marczewski

Hello!

I would like to display pictures on my www AT RANDOM!
So, every visit different picture downloaded.

Could you please help me how to do it?
Or maybe any URL which could help me?
Any SCRIPT?

Please and thank you very much.

Marcin Marczewski
Warsaw, Poland
+48609999999
 
C

Chris H.

Marcin said:
Hello!

I would like to display pictures on my www AT RANDOM!
So, every visit different picture downloaded.

Could you please help me how to do it?
Or maybe any URL which could help me?
Any SCRIPT?

Please and thank you very much.

Marcin Marczewski
Warsaw, Poland
+48609999999

simple script in perl to be run as cgi:

#!/usr/bin/perl

use strict;

my $image_path = '/images';
my @images = ('img1.jpg', 'img2.jpg', 'img3.jpg');
my $randimg = @images[(rand @images)];

print "Location: $image_path/$randimg\n\n";

can then call from your html like:
<img src=/cgi-bin/randimg.cgi>

i've setup a quick example at: www.nasland.nu/randimg.html so you can see it
in action as well as both the html source and the source of the script i
used.

hope this helps.
 
M

Marcin Marczewski

Chris, I cannot set it up in html website.
Shall I only copy this script and paste into the code of html in my Front
Page programme?

Tell me please.
 
C

Chris H.

Marcin said:
Chris, I cannot set it up in html website.
Shall I only copy this script and paste into the code of html in my Front
Page programme?

Tell me please.

it requires the availability of a cgi-bin on your web host machine. if
you're unsure, ask your provider if you have access to run cgi scripts, and
if so, where you may place them so that they can be executed. once you have
that information, you can copy and paste the script, save it as
whatever.cgi, upload it to your bin and place the img tag in your html.
 
L

Leif K-Brooks

Marcin said:
Chris, I cannot set it up in html website.
Shall I only copy this script and paste into the code of html in my Front
Page programme?

(Please try to quote some of the message you're replying to to give your
message a context. It makes healthy archives.)

You can't do random images or anything else dynamic with plain HTML.
You'll need some kind of server-side scripting like PHP, Perl, Python.
Ask your web host what they support.

On the subject of Frontpage, don't use it. The HTML it generates is
really bad; highly skilled hands could probably use it effectively, but
that would just be a waste of time. If you really need a WYSINWIG editor
(you don't), try Dreamweaver. It's not great, but it beats Frontpage.
 
L

lostinspace

----- Original Message -----
From: "Leif K-Brooks" <>
Newsgroups: alt.html
Sent: Saturday, September 18, 2004 5:15 AM
Subject: Re: Random pictures display

<snip>

"On the subject of Frontpage, don't use it. The HTML it generates is
really bad; highly skilled hands could probably use it effectively, but
that would just be a waste of time."

<snip>

FP has long been blamed for bad and bloated html, fact is that the majority
of bloated and bad MS html is created by Ms-Word or users copying and
pasting from MS-Word and into FP.
FP still generates bloat, however nothing in comparison.

MS's primary intent in adding the HTML option to Word was in providing a
transport to RETURN Word created HTML pages back in to Word Documents (AKA
Bloat.)
 
M

Marcin Marczewski

I've asked and I have it.
it is paid service so they have got everything there available.
 
W

WebcastMaker

FP has long been blamed for bad and bloated html, fact is that the majority
of bloated and bad MS html is created by Ms-Word or users copying and
pasting from MS-Word and into FP.
FP still generates bloat, however nothing in comparison.
MS's primary intent in adding the HTML option to Word was in providing a
transport to RETURN Word created HTML pages back in to Word Documents (AKA
Bloat.)

Not sure where your going with this... but thanks, I guess?
 
D

Daniel R. Tobias

Chris H. said:
can then call from your html like:
<img src=/cgi-bin/randimg.cgi>

It's invalid to put attribute values with slashes in HTML without
surrounding them with quotes, and the ALT attribute is mandatory, so
that should be:
<img src="/cgi-bin/randimg.cgi" alt="[Random Image]">
(with something appropriate in the "alt" value).
 
C

Chris H.

Daniel said:
Chris H. said:
can then call from your html like:
<img src=/cgi-bin/randimg.cgi>

It's invalid to put attribute values with slashes in HTML without
surrounding them with quotes, and the ALT attribute is mandatory, so
that should be:
<img src="/cgi-bin/randimg.cgi" alt="[Random Image]">
(with something appropriate in the "alt" value).

you obviously took this to seriously. its called a quick example for a
reason. there's no need to complain about it. if he wants it to be proper,
im sure he could figure it out. thanks.
 
J

Jeffrey Silverman

I've asked and I have it.
it is paid service so they have got everything there available.

*everything*??

Okay, well, here is a simple PHP script to do a random image. Just dump
images into the "rangom_image" directory and they will automatically be
included in the pool of random images.

Mind you, this PHP snippet is incomplete; you will need to incorporate it
into a "real" web page to be useful.

http://engineering.jhu.edu/~jeff/random_image.php

later...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top