1 |
tdb |
1.1 |
#!/usr/local/bin/perl -w |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
$| = 1; |
5 |
|
|
|
6 |
|
|
# Directory to find images in |
7 |
tdb |
1.2 |
my($dir) = "/web/i-scream/htdocs/logos"; |
8 |
tdb |
1.1 |
# Pattern to match images - remember to escape |
9 |
|
|
my($pattern) = "\\.jpg\$"; |
10 |
|
|
|
11 |
|
|
# URL to images - must match $dir |
12 |
tdb |
1.2 |
my($url) = "http://www.i-scream.org/logos"; |
13 |
tdb |
1.1 |
|
14 |
|
|
# Where the setbg command is |
15 |
tdb |
1.2 |
my($setbg) = "/web/i-scream/bin/setbg.pl"; |
16 |
tdb |
1.1 |
|
17 |
|
|
# Code... |
18 |
|
|
my($imagepath) = `$setbg -r -p \'$pattern\' -b echo -f \' \' $dir`; |
19 |
|
|
chomp $imagepath; |
20 |
|
|
$imagepath =~ s/$dir/$url/; |
21 |
|
|
|
22 |
tdb |
1.3 |
# Check for IPv6 |
23 |
|
|
if($ENV{SERVER_ADDR} =~ /:/) { |
24 |
|
|
$imagepath = "http://www.i-scream.org/images/ipv6-logo.gif"; |
25 |
|
|
} |
26 |
|
|
|
27 |
tdb |
1.1 |
print "Content-type: text/plain\n\n"; |
28 |
|
|
print $imagepath; |
29 |
|
|
|
30 |
|
|
exit 0; |