diff --git a/symlink-images-by-aspect-ratio.pl b/symlink-images-by-aspect-ratio.pl index 4b77b20..ed27184 100755 --- a/symlink-images-by-aspect-ratio.pl +++ b/symlink-images-by-aspect-ratio.pl @@ -12,8 +12,8 @@ use Data::Dumper::Simple; use Math::Round; my $conf = { - src_dir => "./pics", - dst_dir => "./links", + src_dir => "./slike", + dst_dir => "./linki", debug => 0, }; @@ -66,7 +66,7 @@ my $ars = {}; my $files = {}; # a hashref that holds all the files, their exif data, and their calculcated aspect ratio foreach my $f (@list) { $count++; - msg_debug "Gathering info for image in file: '$f'\n"; + msg "Gathering info for image in file: '$f'\n"; my $e = Image::EXIF->new($f); my $exif = $e->get_image_info(); @@ -90,15 +90,16 @@ foreach my $f (@list) { } # Calculate aspect ratio and append it into the hash + my $ar; if ($error_flag) { - msg "Unable to calculate aspect ratio for image '$f'. Skipping it.\n" + msg "Unable to calculate aspect ratio for image '$f'.\n"; + $ar = "unknown"; } else { - my $ar; $ar = nearest(0.01, ($x > $y) ? $x / $y : $y / $x) unless $error_flag; - $ars->{$ar}++; - $files->{$f}->{ar} = $ar; } + $ars->{$ar}++; + $files->{$f}->{ar} = $ar; # Append the exif data into hash $files->{$f}->{exif} = $exif;