Add tests for WebGUI::Storage::Image, and give its getThumbnailUrl method

some error handling.
This commit is contained in:
Colin Kuskie 2007-07-24 03:40:57 +00:00
parent 07cb430be4
commit 226dd2cf21
2 changed files with 23 additions and 2 deletions

View file

@ -235,6 +235,14 @@ The file to retrieve the thumbnail for.
sub getThumbnailUrl {
my $self = shift;
my $filename = shift;
if (! defined $filename) {
$self->session->errorHandler->error("Can't make a thumbnail url without a filename.");
return '';
}
if (! isIn($filename, @{ $self->getFiles() })) {
$self->session->errorHandler->error("Can't make a thumbnail for a file that is not in my storage location.");
return '';
}
return $self->getUrl("thumb-".$filename);
}