From f749d2d2601c4078910ac28c1f88dd69055e757f Mon Sep 17 00:00:00 2001 From: Roy Johnson Date: Sat, 18 Nov 2006 18:06:54 +0000 Subject: [PATCH] fix - Storage::Image copy does not create thumbnails --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Storage.pm | 8 ++++++-- lib/WebGUI/Storage/Image.pm | 20 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 73e3fc5a3..2f03899f3 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,7 @@ - fix: Show Debugging option not working - fix: Workflow form control edit button won't work. removed. - fix: Bug in HttpProxy.pm + - fix: Storage::Image copy does not create thumbnails 7.2.1 - Made a change to version tag commits to deal with unusually long commit diff --git a/lib/WebGUI/Storage.pm b/lib/WebGUI/Storage.pm index 736d1207e..4731eebb9 100644 --- a/lib/WebGUI/Storage.pm +++ b/lib/WebGUI/Storage.pm @@ -290,7 +290,7 @@ sub addFileFromScalar { #------------------------------------------------------------------- -=head2 copy ( [ storage ] ) +=head2 copy ( [ storage, filelist ] ) Copies a storage location and it's contents. Returns a new storage location object. Note that this does not copy privileges or other special filesystem properties. @@ -298,12 +298,16 @@ Copies a storage location and it's contents. Returns a new storage location obje Optionally pass in a storage object to copy the data to. +=head3 filelist + +Optionally pass in the list of filenames to copy from the specified storage location + =cut sub copy { my $self = shift; my $newStorage = shift || WebGUI::Storage->create($self->session); - my $filelist = $self->getFiles(1); + my $filelist = shift || $self->getFiles(1); foreach my $file (@{$filelist}) { my $source = FileHandle->new($self->getPath($file),"r"); if (defined $source) { diff --git a/lib/WebGUI/Storage/Image.pm b/lib/WebGUI/Storage/Image.pm index db2be363c..6b2a08086 100644 --- a/lib/WebGUI/Storage/Image.pm +++ b/lib/WebGUI/Storage/Image.pm @@ -74,6 +74,26 @@ sub addFileFromCaptcha { return ($filename, $challenge); } +#------------------------------------------------------------------- + +=head2 copy ( [ storage ] ) + +Overriding the copy method so that thumbnail files are copied along with other image files + +=head3 storage + +Optionally pass a storage object to copy the files to. + +=cut + +sub copy { + my $self = shift; + my $newStorage = shift; + # Storage::Image->getFiles excludes thumbnails from the filelist and we want to copy the thumbnails + my $filelist = $self->SUPER::getFiles(1); + + return $self->SUPER::copy($newStorage, $filelist); +} #-------------------------------------------------------------------