From b9a4e9c8a68dcb6b17617f4f7a5ad5ad3298bfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 9 Mar 2016 22:05:38 +0100 Subject: Imported Upstream version 1.7.1 --- lib/gcstar/GCExport/GCExportBase.pm | 39 +++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'lib/gcstar/GCExport/GCExportBase.pm') diff --git a/lib/gcstar/GCExport/GCExportBase.pm b/lib/gcstar/GCExport/GCExportBase.pm index fb23ec2..0c229d7 100644 --- a/lib/gcstar/GCExport/GCExportBase.pm +++ b/lib/gcstar/GCExport/GCExportBase.pm @@ -133,6 +133,29 @@ use GCExportImport; return $self->{options}->{parent}->getUniqueImageFileName($suffix, $title, $dir); } + sub createMiniature + { + my ($self, $source, $dest, $newHeight) = @_; + + $source =~ /.*?(\.[^.]*)$/; + my $suffix = $1; + my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($source); + my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height); + my $picWidth = $width * ($newHeight / $height); + $pixbuf = GCUtils::scaleMaxPixbuf($pixbuf, $picWidth, $newHeight, 1); + my $format; + if ($suffix =~ /png/i) + { + $format = 'png'; + } + else + { + $dest =~ s/\.[^.]*$/\.jpg/; + $format = 'jpeg'; + } + $pixbuf->save($dest, $format); + } + sub duplicatePicture { my ($self, $orig, $field, $dir, $title, $newHeight) = @_; @@ -157,21 +180,7 @@ use GCExportImport; my $picHeight = $self->getNewPictureHeight; if ($picHeight) { - my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($newPic); - my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height); - my $picWidth = $width * ($picHeight / $height); - $pixbuf = GCUtils::scaleMaxPixbuf($pixbuf, $picWidth, $picHeight, 1); - my $format; - if ($suffix =~ /png/i) - { - $format = 'png'; - } - else - { - $dest =~ s/\.[^.]*$/\.jpg/; - $format = 'jpeg'; - } - $pixbuf->save($dest, $format); + $self->createMiniature($newPic, $dest, $picHeight); } else { -- cgit v1.2.3