Fixed Image uploads only respect maximum size on update
This commit is contained in:
parent
a5de078f13
commit
47d6a95a7f
2 changed files with 15 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue