Templatized Download manager

This commit is contained in:
JT Smith 2002-11-25 22:11:17 +00:00
parent 665f3bdc1e
commit 679a5bc92b
6 changed files with 211 additions and 181 deletions

View file

@ -48,6 +48,7 @@ use WebGUI::Utility;
$url = $attachment->getThumbnail;
$string = $attachment->getType;
$url = $attachment->getURL;
$boolean = $attachment->isImage;
$attachment->copy("files","10");
$attachment->delete;
$attachment->deleteNode;
@ -68,7 +69,7 @@ use WebGUI::Utility;
#-------------------------------------------------------------------
sub _createThumbnail {
my ($image, $error, $x, $y, $r, $n);
if ($hasImageMagick && isIn($_[0]->getType, qw(jpg jpeg gif png tif tiff bmp))) {
if ($hasImageMagick && $_[0]->isImage) {
$image = Image::Magick->new;
$error = $image->Read($_[0]->getPath);
WebGUI::ErrorHandler::warn("Couldn't read image for thumnail creation: ".$error) if $error;
@ -390,6 +391,18 @@ sub getURL {
}
#-------------------------------------------------------------------
=head2 isImage ( )
Returns a 1 or 0 depending on whether the file is an image or not.
=cut
sub isImage {
return isIn($_[0]->getType, qw(gif jpeg jpg tif tiff png bmp)),;
}
#-------------------------------------------------------------------
=head2 new ( filename, node [, nodeSubordinate ] )