use Errno;
use Exporter qw{import};
use File::stat;
+use Image::ExifTool qw{};
use Image::Imlib2;
use User::pwent;
use POSIX;
###--------------------------------------------------------------------------
### Scaled images.
+my %ORIENT =
+ (1 => [0, 0],
+ 2 => [0, 1],
+ 3 => [2, 0],
+ 4 => [2, 1],
+ 5 => [3, 1],
+ 6 => [1, 0],
+ 7 => [1, 1],
+ 8 => [3, 0]);
+
package TrivGal::Image {
use File::Path qw{make_path};
use File::stat;
my $img = $me->{img};
unless (defined $img) {
my $imgpath = "$IMGROOT/$path";
+ my $exif = new Image::ExifTool;
+ $exif->ExtractInfo($imgpath);
+ my $orient = $exif->GetValue("Orientation", "ValueConv");
$img = $me->{img} = Image::Imlib2->load($imgpath);
+ if (defined $orient) {
+ my ($rot, $flip) = @{$ORIENT{$orient}};
+ if ($rot) { $img->image_orientate($rot); }
+ if ($flip) { $img->flip_horizontal($rot); }
+ }
}
my ($wd, $ht) = ($img->width, $img->height);