some fixes after Storage and Storage::Image merge
This commit is contained in:
parent
706b24bcb6
commit
6073703999
3 changed files with 8 additions and 5 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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') {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue