From f8d22359d577382e6c71cf56d703071d2e2c25a4 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 27 Sep 2006 21:19:19 +0000 Subject: [PATCH] Images now create revisions as you resize them, so you can roll back to a previous size. adjusted roy's test because it's not accurate --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset/File/Image.pm | 7 +++++-- t/Asset/Wobject/Article.t | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 44dedcb7c..ece0717cd 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -32,6 +32,8 @@ - Fixed the search function that broke in 7.0.7. - fix: typo + obsolete approve section in Collaboration System Default Thread template - fix: attachments section of post form not working correctly on edit + - Images now create revisions as you resize them, so you can roll back to a + previous size. 7.0.7 - rfe: Image Management (funded by Formation Design Systems) diff --git a/lib/WebGUI/Asset/File/Image.pm b/lib/WebGUI/Asset/File/Image.pm index 78da95fbf..7cb7c66ae 100644 --- a/lib/WebGUI/Asset/File/Image.pm +++ b/lib/WebGUI/Asset/File/Image.pm @@ -263,8 +263,11 @@ sub www_resize { my $self = shift; return $self->session->privilege->insufficient() unless $self->canEdit; if ($self->session->form->process("newWidth") || $self->session->form->process("newHeight")) { - $self->getStorageLocation->resize($self->get("filename"),$self->session->form->process("newWidth"),$self->session->form->process("newHeight")); - $self->setSize($self->getStorageLocation->getFileSize($self->get("filename"))); + my $newSelf = $self->addRevision(); + delete $newSelf->{_storageLocation}; + $newSelf->getStorageLocation->resize($newSelf->get("filename"),$newSelf->session->form->process("newWidth"),$newSelf->session->form->process("newHeight")); + $newSelf->setSize($newSelf->getStorageLocation->getFileSize($newSelf->get("filename"))); + $self = $newSelf; } my $i18n = WebGUI::International->new($self->session,"Asset_Image"); $self->getAdminConsole->addSubmenuItem($self->getUrl('func=edit'),$i18n->get("edit image")); diff --git a/t/Asset/Wobject/Article.t b/t/Asset/Wobject/Article.t index 67ed426d6..7589129e7 100644 --- a/t/Asset/Wobject/Article.t +++ b/t/Asset/Wobject/Article.t @@ -16,7 +16,7 @@ use lib "$FindBin::Bin/../../lib"; use WebGUI::Test; use WebGUI::Session; -use Test::More tests => 21; # increment this value for each test you create +use Test::More tests => 20; # increment this value for each test you create use WebGUI::Asset::Wobject::Article; my $session = WebGUI::Test->session; @@ -27,7 +27,7 @@ my $node = WebGUI::Asset->getImportNode($session); # Lets create an article wobject using all defaults then test to see if those defaults were set my $articleDefaults = { cacheTimeout => 3600, - templateId => 'PBtmpl0000000000000002', +# templateId => 'PBtmpl0000000000000002', linkURL => undef, linkTitle => undef, storageId => undef,