forward port of double-thumbnail bug. Image was inheriting a Storage object from File, and needed a Storage::Image object
This commit is contained in:
parent
0db9d14a94
commit
7abd54eb94
4 changed files with 48 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
--------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue