From 308671edd06bbd6ac69ab81a7d8bdf356de259bb Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Thu, 27 Mar 2008 19:15:51 +0000 Subject: [PATCH] fixed: Collaboration System attachments follow site's max size instead of CS's --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Post.pm | 2 +- lib/WebGUI/Storage/Image.pm | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index d227b5aaf..0bd2d4f3e 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.5.9 + - fixed: Collaboration System attachments follow site's max size instead of CS's 7.5.8 - moved Gallery utility methods to WebGUI::Utility::Gallery diff --git a/lib/WebGUI/Asset/Post.pm b/lib/WebGUI/Asset/Post.pm index 408147a30..3c27b2451 100644 --- a/lib/WebGUI/Asset/Post.pm +++ b/lib/WebGUI/Asset/Post.pm @@ -845,7 +845,7 @@ sub postProcess { my $storage = $self->getStorageLocation; foreach my $file (@{$storage->getFiles}) { if ($storage->isImage($file)) { - $storage->adjustMaxImageSize($file); + $storage->adjustMaxImageSize($file, $self->getThread->getParent->get('maxImageSize')); $storage->generateThumbnail($file, $self->getThread->getParent->get("thumbnailSize")); } $size += $storage->getFileSize($file); diff --git a/lib/WebGUI/Storage/Image.pm b/lib/WebGUI/Storage/Image.pm index 8e66cfca0..1e0fbf314 100644 --- a/lib/WebGUI/Storage/Image.pm +++ b/lib/WebGUI/Storage/Image.pm @@ -130,11 +130,10 @@ The name of the file to check for a maximum file size violation. =cut sub adjustMaxImageSize { - my $self = shift; + my $self = shift; my $file = shift; + my $max_size = shift || $self->session->setting->get("maxImageSize"); my ($w, $h) = $self->getSizeInPixels($file); - my $max_size = $self->session->setting->get("maxImageSize"); - my $resized = 0; if($w > $max_size || $h > $max_size) { if($w > $h) { $self->resize($file, $max_size); @@ -142,9 +141,9 @@ sub adjustMaxImageSize { else { $self->resize($file, 0, $max_size); } - $resized = 1; + return 1; } - return $resized; + return 0; } #-------------------------------------------------------------------