#!/usr/bin/perl
# 
#  ImageFooter.pm - A perlmodule faciliating the creation of Image tags for
#                   the oroborus.org footer
# 
#  Copyright (C) 2002 Stefan Pfetzing
# 
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
# 
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
# 
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software Foundation,
#  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
# 

# define the Package name
package Oroborus::ImageFooter;

#use Apache::Reload;
use strict;
use Oroborus::Image;

# constructor needs two arguments, a reference to the cgi object and an array
# reference with:
#     the image location (relative),
#     the URL to which the image points,
#     the Alt name.
sub new($$) {
	my $proto = shift();
	my $q = shift();
	my $ref = shift();
	my $image = new Oroborus::Image($$ref[0]);
	# return false if ref is not a reference.
	return 0 unless(ref($ref));
	my $class = ref($proto) || $proto;
	my $self  = {};
	bless ($self, $class);
	$self->{_STRING} = $q->a({-href=>$$ref[1]},
		$q->img({-style=>"border:0;width:".$image->getX()."px;height:".$image->getY()."px",
			-src=>$$ref[0],
			-alt=>$$ref[2]}));
	return $self;
}

# destructor
sub DESTROY() {
};

sub toString() {
	my $self = shift();
	return $self->{_STRING};
}

# return a true value
1;
__END__


