Imageviewer

Access to your image galleries.

Edit following line in imageviewer.pl to setup your folders.

my @rootdir = ("/path/to/images/", "/somewhere/else/", "...");

Download

Comments

Hi Phill,

the following modification autorotates the image if exif:Orientation data is present. At the moment, only left rotate -90 degrees ;-)) You'll see, where I put the modifications... Perhaps one could figure out how to identify other orientations and rotate the picture appropriately.
----------------------------------------------------
sub printpic {

print "Content-Type: image/jpeg\n\n";
binmode STDOUT;

if ($cgi ->url_param('width')) {

require Image::Magick;

my $bildle = Image::Magick->new;
$bildle->Read($cgi ->url_param('picture'));

------->my %exif = map { s/\s+\z//; $_ }
-------> map { split /=/, $_ }
-------> split /exif:/, $bildle->Get('format', '%[EXIF:*]');

my ($Breite_Quelle,$Hoehe_Quelle) = $bildle->Get('columns', 'rows');

my $Hoehe_Ziel= $Hoehe_Quelle / $Breite_Quelle * $cgi ->url_param('width');

$bildle->Thumbnail( width => $cgi ->url_param('width'), height => $Hoehe_Ziel );
------->if ($exif{"Orientation"} == 8) {
-------> $bildle->Rotate( degrees => -90, background => '#00000000');
------->}

# Wasserzeichen<->
....
----------------------------------------------------------------------------

Somebody can test this?

my %exif = map { s/\s+\z//; $_ }
map { split /=/, $_ }
split /exif:/, $bildle->Get('format', '%[EXIF:*]');

if ($exif{"Orientation"} == 3) {
$bildle->Rotate( degrees => 180, background => '#00000000');
}
if ($exif{"Orientation"} == 6) {
$bildle->Rotate( degrees => 90, background => '#00000000');
}
if ($exif{"Orientation"} == 8) {
$bildle->Rotate( degrees => -90, background => '#00000000');
}

Mirroring is not really necessary, right?

Hi!

Yep, that's it. I also think mirroring isn't necessary according to this page: http://www.impulseadventure.com/photo/exif-orientation.html