Fix images in collaboration systems

This commit is contained in:
Graham Knop 2007-04-26 22:11:20 +00:00
parent 54a20b9c65
commit abdb789902
2 changed files with 12 additions and 5 deletions

View file

@ -1,5 +1,6 @@
7.3.16
- fix: The POD of Form::Image is faulty (perlDreamer Consulting, LLC)
- fix: Images in Collaboration Systems were broken in 7.3.15

View file

@ -813,11 +813,17 @@ sub postProcess {
my $storage = $self->getStorageLocation;
foreach my $file (@{$storage->getFiles}) {
if ($storage->isImage($file)) {
##Use generateThumbnail to shrink size to site's max image size
##We should look into using the new resize method instead.
$storage->generateThumbnail($file, $self->getThread->getParent->get("maxImageSize") || $self->session->setting->get("maxImageSize"));
$storage->deleteFile($file);
$storage->renameFile('thumb-'.$file,$file);
my ($w, $h) = $storage->getSizeInPixels($file);
my $max_size = $self->getThread->getParent->get("maxImageSize")
|| $self->session->setting->get("maxImageSize");
if($w > $max_size || $h > $max_size) {
if($w > $h) {
$storage->resize($file, $max_size);
}
else {
$storage->resize($file, 0, $max_size);
}
}
$storage->generateThumbnail($file, $self->getThread->getParent->get("thumbnailSize"));
}
$size += $storage->getFileSize($file);