7 use Text::CSV qw( csv );
8 use Data::Dump qw( dump );
10 use Clone qw( clone );
12 my $file = 'keramika.csv';
13 my $aoh = csv (in => $file, headers => "auto");
15 open(my $fh, '>', 'keramika.js');
18 foreach my $i ( @$aoh ) {
19 my $source = sprintf( "ZBIRKA-NEOLITIK/%02d.png", $i->{ID} );
20 my $image = sprintf( "image/%d.jpg" , $i->{ID} );
21 my $thumb = sprintf( "thumb/%d.jpg" , $i->{ID} );
22 system "convert -trim $source $image";
23 system "convert -geometry 100x $image $thumb";
25 $i->{thumbnail} = $thumb;
26 # $i->{label} = $i->{opis_predmeta};
27 $i->{label} = $i->{ID};
28 warn "# i = ",dump($i);
29 push @{ $json->{items} }, $i;
30 # foreach my $n ( 1 .. 1000 ) {
32 # $i2->{label} .= "_" . $n;
33 # push @{ $json->{items} }, $i2;
37 print $fh encode_json( $json );