word: mkwordthumb script to recreate images
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 15 Aug 2021 02:11:28 +0000 (04:11 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 25 Oct 2021 14:33:21 +0000 (16:33 +0200)
tools/mkwordthumb [new file with mode: 0755]

diff --git a/tools/mkwordthumb b/tools/mkwordthumb
new file mode 100755 (executable)
index 0000000..6d1ac67
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+use 5.014;
+use warnings;
+use lib '.';
+use Shiar_Sheet::ImagePrep;
+use Shiar_Sheet::DB;
+
+our $VERSION = '1.00';
+
+my $db = Shiar_Sheet::DB->connect;
+my %filter = @ARGV ? (id => shift) : ();
+my $query = $db->select(word => '*', \%filter);
+
+while (my $row = $query->hash) {
+       my $image = Shiar_Sheet::ImagePrep->new("data/word/org/$row->{id}.jpg");
+       eval {
+               $image->convert("data/word/en/$row->{id}.jpg", $row->{thumb});
+       } or warn "$row->{id}: @{$@}";
+}