--- /dev/null
+#!/usr/bin/perl
+# Check that thumbnail aspect ratios match pre-migration data
+
+use strict;
+use warnings;
+
+use UCW::Gallery;
+
+my $gal = UCW::Gallery->load_config;
+my $meta = $gal->read_meta($gal->cache_meta_name);
+
+open T, "gallery.thumb" or die "Cannot read gallery.thumb\n";
+my @thumbs = ();
+while (<T>) {
+ chomp;
+ my ($name, $tw, $th) = split /\s+/;
+ push @thumbs, [ $tw, $th ];
+}
+close T;
+
+for my $id (@{$meta->{sequence}}) {
+ my ($tw, $th) = @{shift @thumbs} or die;
+ my $ta = $tw / $th;
+ my $m = $meta->{photo}->{$id} or die;
+ my $pw = $m->{w};
+ my $ph = $m->{h};
+ my $pa = $pw / $ph;
+ if (abs($ta - $pa) > 0.05) {
+ if (abs($ta - 1/$pa) > 0.05) {
+ print STDERR "$id: Mismatched aspect ratio: orig $ta (${tw}x${th}) new $pa (${pw}x${ph})\n";
+ } else {
+ print STDERR "$id: Mismatched rotation\n";
+ }
+ }
+}