diff --git a/lib/WebGUI/Storage.pm b/lib/WebGUI/Storage.pm index f2e941191..5af596fdb 100644 --- a/lib/WebGUI/Storage.pm +++ b/lib/WebGUI/Storage.pm @@ -578,8 +578,8 @@ sub deleteFile { my $filename = shift; return undef if $filename =~ m{\.\./}; ##prevent deleting files outside of this object - unlink($self->getPath($filename)); unlink($self->getPath('thumb-'.$filename)); + unlink($self->getPath($filename)); } @@ -1113,7 +1113,10 @@ sub resize { # Next, resize dimensions if ( $width || $height ) { - $self->session->errorHandler->info( "Resizing $filename to w:$width h:$height" ); + if (!$height && $width =~ /^(\d+)x(\d+)$/) { + $width = $1; + $height = $2; + } my ($x, $y) = $image->Get('width','height'); if (!$height) { # proportional scale by width $height = $width / $x * $y; @@ -1121,6 +1124,7 @@ sub resize { elsif (!$width) { # proportional scale by height $width = $height * $x / $y; } + $self->session->errorHandler->info( "Resizing $filename to w:$width h:$height" ); $image->Resize( height => $height, width => $width ); } diff --git a/t/Asset/File.t b/t/Asset/File.t index 2d5275db0..01673042f 100644 --- a/t/Asset/File.t +++ b/t/Asset/File.t @@ -24,7 +24,7 @@ use WebGUI::Asset::File; use Test::More; # increment this value for each test you create use Test::Deep; -plan tests => 9; +plan tests => 8; #TODO: This script tests certain aspects of WebGUI::Storage and it should not @@ -87,7 +87,6 @@ my $fileStorage = WebGUI::Storage->create($session); $mocker->set_always('getValue', $fileStorage->getId); my $fileFormStorage = $asset->getStorageFromPost(); isa_ok($fileFormStorage, 'WebGUI::Storage', 'Asset::File::getStorageFromPost'); -isnt(ref $fileFormStorage, 'WebGUI::Storage', 'getStorageFromPost does not return an image storage object'); END { if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') { diff --git a/t/Macro/Thumbnail.t b/t/Macro/Thumbnail.t index 8cd0575dd..a06a13aa4 100644 --- a/t/Macro/Thumbnail.t +++ b/t/Macro/Thumbnail.t @@ -20,7 +20,7 @@ use WebGUI::Storage; use Image::Magick; use Test::More; # increment this value for each test you create use Test::Deep; -plan tests => 9; +plan tests => 8; my $session = WebGUI::Test->session;