#
#	A couple of routines for supporting photos
#

use Image::Size;

###
###	Photo
###
###	Generate a button for a photo which refers to a larger photo.
###
$Dir = "left";
sub Photo
    {
    my($fname) = @_;
    my($thumbnail, $full, $x, $y);

    $thumbnail = $fname . "t.jpg";
    $full = $fname . "f.jpg";

#    print OUT "<h3><center>$fname</center></h3>\n";
    if ($Dir ne "left")		{	$Dir = "left";		}
    else			{	$Dir = "right";		}
    ($x, $y) = imgsize($thumbnail);
#    print OUT "<a href=\"$full\"><img src=\"$thumbnail\" align=\"$Dir\" " .
#    		"hspace=10 vspace=10 height=\"$y\" width=\"$x\"></a>\n";
    print OUT "<a href=\"$full\"><img src=\"$thumbnail\" " .
    		"hspace=10 vspace=10 height=\"$y\" width=\"$x\"></a>\n";
    }


###
###	Photo2
###
###	Put out a photo.
###
###	Put in a break before the image unless the last value is "no".
###
sub Photo2
    {
    my($args) = @_;
    my($fname, $dir, $break, $imgname, $x, $y);

    ($fname, $dir, $break) = split(/\s+/, $args);

    print OUT "<br clear=right> <br clear=left>\n"
    		unless (defined($break) && $break eq "no");

    $imgname = "$fname.html";
    ($x, $y) = imgsize("$fname.t.jpg");
    print OUT qq|<a href="$imgname">| .
    	      qq|<img src="$fname.t.jpg" align=$dir hspace=10 vspace=10 | .
	      qq|height="$y" width="$x"></a>|;
    }


###
###	Name
###
###	Shorten a full name to just a first name and last initial.
###
sub Name
    {
    my($name) = @_;

    $name =~ s/(\S)\S*$/$1/;
    return $name;
    }

$Callable{'Name'} = 1;

1;
