/[corp]/pics/menu.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /pics/menu.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Sep 10 10:29:06 2001 UTC (22 years, 7 months ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +6 -4 lines
File MIME type: text/plain
fix

1 #!/usr/local/bin/perl -w
2
3 use Image::Magick;
4 use DBI;
5
6 my $dest_dir="/data/corp_html/m";
7
8 sub dump_gif {
9 my ($text) = @_;
10 my $file=$text;
11 $file=~s/[^a-zA-Z]+/_/g;
12
13 print "$text";
14
15 $image = Image::Magick->new;
16 #$image->Set(size=>'125x15');
17 $image->Set(size=>'250x30');
18 $image->ReadImage('xc:#2a377e');
19
20 $image->Annotate(text=>$text,
21 geometry=>'+14+21',
22 font=>"\@arialbd.ttf",
23 pointsize=>20,
24 pen=>'white',
25 fill=> '#ffffff',
26 align=>'left');
27
28
29 #$image->Resize(geometry=>'125x15', filter=>'Lanczos', blur=>1.8);
30 #$image->GaussianBlur(radius=>1);
31 $image->Scale(geometry=>'50%');
32
33 $image->Draw(stroke=>'#cccccc', primitive=>'line', points=>'0,13 118,13', linewidth=>1);
34 $image->Draw(stroke=>'#cccccc', primitive=>'line', points=>'118,13 118,7', linewidth=>2);
35
36
37 if (0) {
38 $image->Annotate(text=>
39 geometry=>'+7+2',
40 font=>"\@/usr/local/ttfonts/arialbd.ttf",
41 pointsize=>10,
42 pen=>'white',
43 align=>'left');
44 }
45
46 print " -> ";
47
48 $image->Write(filename=>"gif:$dest_dir/$file.gif",
49 colors=>256,
50 interlace=>"none",
51 compress=>'lzw');
52
53 print "$file.gif\n";
54
55 return "$file.gif";
56
57 }
58
59 my $connect = "DBI:Pg:dbname=corp";
60
61 my $dbh = DBI->connect("$connect","","") || die $DBI::errstr;
62 $sth = $dbh->prepare("select section,item,url from menu") || die $dbh->errstr();
63 $sth->execute() || die $sth->errstr();
64
65 while (@arr = $sth->fetchrow_array() ) {
66 $dbh->do("update menu set file='".dump_gif($arr[1])."' where item='$arr[1]'");
67 }

  ViewVC Help
Powered by ViewVC 1.1.26