#!/usr/bin/perl

($fn,$bg)=split(/@/,$ENV{"QUERY_STRING"});
if($fn=~/^([^\|]*)\|(.*)$/)
{
  ($fn,$ff)=($1,$2);
}

$fn="/$fn";
$fn=~s/^\/\//\//g;

$plain=($0=~/plain/);

$fname="/www/www.spitfire.spb.ru/$fn";
$_=`/www/www.spitfire.spb.ru/src/xy/xy $fname`;
($x,$y)=split;
if($x>0 && $y>0)
{
  $szinfo="height=$x width=$y";
}

$rus="_rus" if($0=~/_rus/);

$yy=24+($yy0=12*int(($y+11)/12));
$xx=12*int(($x+11)/12);

if($ff)
{
  $ref="<a href=\"/cgi-bin/show_image.cgi?$ff\">";
  $unref="</a>";
}

print <<EOF;
Content-type: text/html

<html>
<head>
<title>
Image ${x}x$y
</title>
</head>


<body bgcolor="black" link=RED alink=RED vlink=RED text=white>

<center>

EOF

$path ="http://jukebox.peterlink.ru/images/spbw";
print(($szinfo && !$plain)?<<EOF:<<QQQ);
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td colspan=3><img src="$path/12.$yy.gif" height=12 width=$yy></td>
</tr>
<tr>
<td><img src="$path/$xx.12.gif" width=12 height=$xx></td>
<td valign="middle" align="center" width=$yy0
height=$xx>$ref<img
src="$fn" $szinfo border=0>$unref</td>
<td><img src="$path/$xx.12.gif" width=12 height=$xx></td>
</tr>
<tr>
<td colspan=3><img src="$path/12.$yy.gif" height=12 width=$yy></td>
</tr>
</table>

</body>
</html>
EOF
$ref<img
src="$fn" $szinfo border=0>$unref

QQQ

