Add tests for WebGUI::Storage::Image, and give its getThumbnailUrl method
some error handling.
This commit is contained in:
parent
07cb430be4
commit
226dd2cf21
2 changed files with 23 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue