summaryrefslogtreecommitdiff
path: root/lib/gcstar/GCExport/GCExportBase.pm
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2016-03-09 22:05:38 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2016-03-09 22:05:38 +0100
commitb9a4e9c8a68dcb6b17617f4f7a5ad5ad3298bfa9 (patch)
tree55b47f0b304ebea5608d98f0a978b150e5ab30c8 /lib/gcstar/GCExport/GCExportBase.pm
parent126bb8cb6b93240bb4d3a2b816b74c286c3d422b (diff)
Imported Upstream version 1.7.1upstream/1.7.1upstream
Diffstat (limited to 'lib/gcstar/GCExport/GCExportBase.pm')
-rw-r--r--lib/gcstar/GCExport/GCExportBase.pm39
1 files changed, 24 insertions, 15 deletions
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
{