]> i-scream Git - www.i-scream.org.git/commitdiff
logo.jpg picks an image at random and returns *it*
authorTim Bishop <tim@bishnet.net>
Wed, 24 Mar 2004 23:48:57 +0000 (23:48 +0000)
committerTim Bishop <tim@bishnet.net>
Wed, 24 Mar 2004 23:48:57 +0000 (23:48 +0000)
logo.cgi picks an image at random and returns the *URL* to it

cgi-bin/logo.cgi [new file with mode: 0755]

diff --git a/cgi-bin/logo.cgi b/cgi-bin/logo.cgi
new file mode 100755 (executable)
index 0000000..837e1eb
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/local/bin/perl -w
+
+use strict;
+$| = 1;
+
+# Directory to find images in
+my($dir) = "/web/i-scream/nwww/logos";
+# Pattern to match images - remember to escape
+my($pattern) = "\\.jpg\$";
+
+# URL to images - must match $dir
+my($url) = "http://nwww.i-scream.org/logos";
+
+# Where the setbg command is
+my($setbg) = "/web/i-scream/nwww.bin/setbg.pl";
+
+# Code...
+my($imagepath) = `$setbg -r -p \'$pattern\' -b echo -f \' \' $dir`;
+chomp $imagepath;
+$imagepath =~ s/$dir/$url/;
+
+print "Content-type: text/plain\n\n";
+print $imagepath;
+
+exit 0;