diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-03-09 22:05:38 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-03-09 22:05:38 +0100 |
commit | b9a4e9c8a68dcb6b17617f4f7a5ad5ad3298bfa9 (patch) | |
tree | 55b47f0b304ebea5608d98f0a978b150e5ab30c8 /lib/gcstar/GCExport/GCExportExternal.pm | |
parent | 126bb8cb6b93240bb4d3a2b816b74c286c3d422b (diff) |
Imported Upstream version 1.7.1upstream/1.7.1upstream
Diffstat (limited to 'lib/gcstar/GCExport/GCExportExternal.pm')
-rw-r--r-- | lib/gcstar/GCExport/GCExportExternal.pm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/gcstar/GCExport/GCExportExternal.pm b/lib/gcstar/GCExport/GCExportExternal.pm index d5c096c..2263387 100644 --- a/lib/gcstar/GCExport/GCExportExternal.pm +++ b/lib/gcstar/GCExport/GCExportExternal.pm @@ -45,6 +45,7 @@ use GCExport::GCExportBase; bless ($self, $class); $self->{useZip} = $self->checkOptionalModule('Archive::Zip'); + $self->{covers} = {}; return $self; } @@ -57,10 +58,13 @@ use GCExport::GCExportBase; sub transformPicturePath { my ($self, $path, $file, $item, $field) = @_; - return $self->duplicatePicture($path, + my $newPath = $self->duplicatePicture($path, $field, $self->{imageDir}, $item->{$self->{model}->{commonFields}->{title}}); + $self->{isCover}->{$newPath} = 1 + if $self->{model}->{commonFields}->{cover} eq $field; + return $newPath; } sub process @@ -123,8 +127,19 @@ use GCExport::GCExportBase; my $zip = Archive::Zip->new(); $zip->addFile(basename($self->{fileName})); $zip->addDirectory(basename($self->{imageDir})); + my $miniDir = $self->{imageDir}.'-mini'; + mkdir $miniDir; + $zip->addDirectory(basename($miniDir)); my @images = glob $imagesSubDir.'/*'; - $zip->addFile($_) foreach @images; + foreach my $image(@images) + { + $zip->addFile($image); + my $imgFile = basename($image); + my $fullFileName = $self->{imageDir}."/$imgFile"; + next if !$self->{isCover}->{$image}; + $self->createMiniature($fullFileName, "$miniDir/$imgFile", 150); + $zip->addFile(basename($miniDir)."/$imgFile"); + } my $result = $zip->writeToFileNamed($outFile); if ($result) { |