diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 697c614bc..f6f6eebc6 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,8 @@ http://www.plainblack.com/bugs/tracker/able-to-edit-locked-template - fix: DataForm does not export entry information (perlDreamer Consulting, LLC) http://www.plainblack.com/bugs/tracker/dataform-does-not-export-entry-information + - fix: Image uploads only respect maximum size on update (Martin Kamerbeek / Oqapi) + http://www.plainblack.com/bugs/tracker/image-uploads-only-respect-maximum-size-on-update 7.3.15 - Added more documentation to WebGUI.pm diff --git a/lib/WebGUI/Asset/FilePile.pm b/lib/WebGUI/Asset/FilePile.pm index 7f3831da9..6b565fb5e 100644 --- a/lib/WebGUI/Asset/FilePile.pm +++ b/lib/WebGUI/Asset/FilePile.pm @@ -165,6 +165,19 @@ sub editSave { if ($selfName eq "WebGUI::Asset::File::Image") { $data{templateId} = 'PBtmpl0000000000000088'; $data{parameters} = 'alt="'.$self->get("title").'"'; + + # Resize image if it is bigger than the max allowed image size. + my $maxSize = $self->session->setting->get("maxImageSize"); + my ($width, $height) = $storage->getSizeInPixels($filename); + if($width > $maxSize || $height > $maxSize) { + if($width > $height) { + $storage->resize($filename, $maxSize); + } + else { + $storage->resize($filename, 0, $maxSize); + } + } + } $data{url} = $self->getParent->get('url').'/'.$filename; my $newAsset = $self->getParent->addChild(\%data);