blob: ff22207e98abc31fa80305a39d346813a92220c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/usr/bin/perl
$ENV{HTTPS} = "on";
use localbucky;
$dbh = DBI->connect ($dsn);
my $doit_id = $ARGV[0];
if (length($doit_id))
{
my $thread = get_thread($doit_id);
check_and_render($thread);
}
else
{
my $threads = get_threads();
foreach my $t (@$threads)
{
check_and_render($t);
}
}
sub check_and_render
{
my ($t) = @_;
my $path = qq($data_path/$t->{id}/.thumb);
my $printed = 0;
my $files = get_files($t->{id});
foreach $f (@$files)
{
next unless ($f->{filename} =~ /(gif|jpe?g|png)$/i);
next unless (-e "$data_path/$f->{parent_id}/$f->{filename}");
system($RM_PATH, "-f", "$path/t.".(lc($f->{filename})));
if (! $printed)
{ print qq(Generating thumbs for $t->{id} -- $t->{title}\n); $printed++; }
print "$f->{filename} ";
make_image_thumb({ file => $f, maxwidth => 145, maxheight => 110, key => $THUMB_LIBRARY_PREFIX });
}
print qq(\n\n) if ($printed);
}
# system("chown", "-R", "carbon:psacln", "$data_path");
$dbh->disconnect();
|