/[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.2 - (show annotations)
Mon Sep 3 13:07:57 2001 UTC (22 years, 9 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +3 -2 lines
File MIME type: text/plain
support za noviji ImageMagick

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

  ViewVC Help
Powered by ViewVC 1.1.26