invidious has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance for your guys' help.#! /usr/bin/perl $urldir = "http://jason.yellowsnow.net/images/"; $dir = "."; opendir(DIR,$dir) || die "Unable to open $urldir: $!"; @files = grep { /\.(?:jpg)$/i } readdir DIR; srand (time ^ $$); $file = rand(@files); open(IMG,$files[$file]) or die "Unable to open $files[$file]: $!"; print "Content-type: image/jpg\n\n"; { print <IMG>; } close IMG; closedir DIR;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Random Image Generator
by Aristotle (Chancellor) on Oct 13, 2003 at 17:27 UTC | |
|
Re: Random Image Generator
by CombatSquirrel (Hermit) on Oct 13, 2003 at 17:31 UTC | |
by bl0rf (Pilgrim) on Oct 15, 2003 at 22:47 UTC | |
|
Re: Random Image Generator
by blokhead (Monsignor) on Oct 13, 2003 at 17:36 UTC | |
by Thelonius (Priest) on Oct 13, 2003 at 19:13 UTC | |
|
Re: Random Image Generator
by Cody Pendant (Prior) on Oct 13, 2003 at 22:03 UTC | |
|
Re: Random Image Generator
by TVSET (Chaplain) on Oct 13, 2003 at 17:51 UTC | |
|
Re: Random Image Generator
by pg (Canon) on Oct 13, 2003 at 18:03 UTC |