diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index b0e5bbf2d..aa1ca0cff 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -59,6 +59,8 @@ http://www.webgui.org/bugs/tracker/activity-sequence-numbers-incorrect-when-editing-workflows#YRH7TYSWFkEUSPVDNN6zKQ - fix: Spectre Should Check That It Has a Valid Workflow (perlDreamer Consulting, LLC) http://www.webgui.org/bugs/tracker/spectre-should-check-that-it-has-a-valid-workflow#lHx4BxEUxcacX7rS5VLxeg + - fix: Problems with thumbnails (perlDreamer Consulting, LLC) + http://www.webgui.org/bugs/tracker/problems-with-thumbnails 7.3.18 diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 900169ec6..c827ab95f 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -7,7 +7,6 @@ upgrading from one version to the next, or even between multiple versions. Be sure to heed the warnings contained herein as they will save you many hours of grief. - 7.4.0 -------------------------------------------------------------------- @@ -31,6 +30,17 @@ save you many hours of grief. the upgrade +7.3.19 +-------------------------------------------------------------------- + + * There was a bug fixed in this release relating to the Image asset. + The bug was that if you edited an Image, then the original image file + in the asset was replaced with its thumbnail. There is no easy way to + automatically fix this the results of this bug. To recover affected + Image Assets, then just upload a copy of the original image file. You + do not need to Trash/Delete the Image Asset. + + 7.3.16 -------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index e7a7abf2c..8a842c525 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -202,6 +202,23 @@ sub getIcon { } +#------------------------------------------------------------------- + +=head2 getStorageFromPost + +We have to wrap this operation because WebGUI::Asset::File::Image calls SUPER processPropertiesFormFormPost, +which gives it the wrong type of Storage object. + +=cut + +sub getStorageFromPost { + my $self = shift; + my $storageId = shift; + my $fileStorageId = WebGUI::Form::File->new($self->session, {name => 'newFile', value=>$storageId })->getValueFromPost; + return WebGUI::Storage->get($self->session, $fileStorageId); +} + + #------------------------------------------------------------------- sub getStorageLocation { @@ -265,8 +282,7 @@ sub processPropertiesFromFormPost { } #Pass in the storage Id to prevent another one from being created. - my $fileStorageId = WebGUI::Form::File->new($session, {name => 'newFile', value=>$storageId })->getValueFromPost; - my $storage = WebGUI::Storage->get($session, $fileStorageId); + my $storage = $self->getStorageFromPost($storageId); if (defined $storage) { $storage->setPrivileges($self->get('ownerUserId'), $self->get('groupIdView'), $self->get('groupIdEdit')); diff --git a/lib/WebGUI/Asset/File/Image.pm b/lib/WebGUI/Asset/File/Image.pm index b5d69e53c..0f637776a 100644 --- a/lib/WebGUI/Asset/File/Image.pm +++ b/lib/WebGUI/Asset/File/Image.pm @@ -147,6 +147,22 @@ sub getEditForm { +#------------------------------------------------------------------- + +=head2 getStorageFromPost + +Sub class this method from WebGUI::Asset::File so the storage object is the correct type. + +=cut + +sub getStorageFromPost { + my $self = shift; + my $storageId = shift; + my $fileStorageId = WebGUI::Form::Image->new($self->session, {name => 'newFile', value=>$storageId })->getValueFromPost; + return WebGUI::Storage::Image->get($self->session, $fileStorageId); +} + + #------------------------------------------------------------------- sub getStorageLocation { @@ -204,13 +220,10 @@ sub processPropertiesFromFormPost { my $self = shift; $self->SUPER::processPropertiesFromFormPost; my $parameters = $self->get("parameters"); + my $storage = $self->getStorageLocation; unless ($parameters =~ /alt\=/) { $self->update({parameters=>$parameters.' alt="'.$self->get("title").'"'}); } - ##We just inherited a storage object of the wrong type. Reinstance the same - ##storage object with the correct type - my $storage = WebGUI::Storage::Image->get($self->session, $self->getStorageLocation->getId); - $self->setStorageLocation($storage); my $max_size = $self->session->setting->get("maxImageSize"); my $file = $self->get("filename"); my ($w, $h) = $storage->getSizeInPixels($file);