14 |
my $h_base=13; |
my $h_base=13; |
15 |
my $h; |
my $h; |
16 |
|
|
17 |
|
my $dir="/data/pliva-si/m"; |
18 |
|
|
19 |
my %iso2utf_tab = ( |
my %iso2utf_tab = ( |
20 |
'¹' => 0x0161, 'ð' => 0x0111, 'è' => 0x010d, 'æ' => 0x0107, '¾' => 0x017e, |
'¹' => 0x0161, 'ð' => 0x0111, 'è' => 0x010d, 'æ' => 0x0107, '¾' => 0x017e, |
21 |
'©' => 0x0160, 'Ð' => 0x0110, 'È' => 0x010c, 'Æ' => 0x0106, '®' => 0x017d |
'©' => 0x0160, 'Ð' => 0x0110, 'È' => 0x010c, 'Æ' => 0x0106, '®' => 0x017d |
37 |
sub dump_gif { |
sub dump_gif { |
38 |
my ($text, $type, $file) = @_; |
my ($text, $type, $file) = @_; |
39 |
$type ||= TYPE_NONE; |
$type ||= TYPE_NONE; |
40 |
$file ||= $text; |
$file ||= "$text-$type"; |
41 |
$file =~ s/[^a-zA-Z0-9\-]/_/g; |
$file =~ s/[^a-zA-Z0-9\-]/_/g; |
42 |
$file = lc($file); |
$file = lc($file); |
43 |
print "$text" unless ($file eq "-"); |
print "$text" unless ($file eq "-"); |
52 |
$text=iso2utf($text); |
$text=iso2utf($text); |
53 |
if ($type == TYPE_BULLET) { |
if ($type == TYPE_BULLET) { |
54 |
$image->Annotate('text' => $text, 'geometry' => '+17+10', |
$image->Annotate('text' => $text, 'geometry' => '+17+10', |
55 |
'font' => "\@arialbd.ttf", 'pointsize' => 11, |
'font' => "\@$dir/arialbd.ttf", 'pointsize' => 11, |
56 |
'fill' => '#ffffff', 'align' => 'left'); |
'fill' => '#ffffff', 'align' => 'left'); |
57 |
# $image->Annotate('text' => $text, 'geometry' => '+17+1', |
# $image->Annotate('text' => $text, 'geometry' => '+17+1', |
58 |
# 'font' => "\@arialbd.ttf", 'pointsize' => 11, |
# 'font' => "\@$dir/arialbd.ttf", 'pointsize' => 11, |
59 |
# 'pen' => '#FFFFFF', 'align' => 'left'); |
# 'pen' => '#FFFFFF', 'align' => 'left'); |
60 |
# $image->Blur('radius' => 0.1); |
# $image->Blur('radius' => 0.1); |
61 |
$image->Draw('primitive' => 'rectangle', 'stroke' => '#00D000', |
$image->Draw('primitive' => 'rectangle', 'stroke' => '#00D000', |
63 |
'7,4 10,7'); |
'7,4 10,7'); |
64 |
} elsif ($type == TYPE_BLUEDOT) { |
} elsif ($type == TYPE_BLUEDOT) { |
65 |
$image->Annotate('text' => $text, 'geometry' => '+17+10', |
$image->Annotate('text' => $text, 'geometry' => '+17+10', |
66 |
'font' => "\@arialbd.ttf", 'pointsize' => 11, |
'font' => "\@$dir/arialbd.ttf", 'pointsize' => 11, |
67 |
'fill' => '#ffffff', 'align' => 'left'); |
'fill' => '#ffffff', 'align' => 'left'); |
68 |
$image->Draw('primitive' => 'rectangle', 'stroke' => '#00b2dc', |
$image->Draw('primitive' => 'rectangle', 'stroke' => '#00b2dc', |
69 |
'fill' => '#00b2dc', 'antialias' => 1, 'points' => |
'fill' => '#00b2dc', 'antialias' => 1, 'points' => |
91 |
} |
} |
92 |
} |
} |
93 |
$image->Annotate('text' => $text, 'geometry' => '+3+10', |
$image->Annotate('text' => $text, 'geometry' => '+3+10', |
94 |
'font' => "\@arialbd.ttf", 'pointsize' => 11, |
'font' => "\@$dir/arialbd.ttf", 'pointsize' => 11, |
95 |
'fill' => '#FFFFFF', 'align' => 'left'); |
'fill' => '#FFFFFF', 'align' => 'left'); |
96 |
# $image->Blur('radius' => 1); |
# $image->Blur('radius' => 1); |
97 |
} |
} |
98 |
print " -> " unless ($file eq "-"); |
print " -> " unless ($file eq "-"); |
99 |
$file .= ".gif" unless ($file eq "-"); |
$file .= ".gif" unless ($file eq "-"); |
100 |
$image->Write('filename' => "gif:$file", 'colors' => 256, |
$image->Write('filename' => "gif:$dir/$file", 'colors' => 256, |
101 |
'interlace' => "none", 'compress' => 'lzw'); |
'interlace' => "none", 'compress' => 'lzw'); |
102 |
print "$file\n" unless ($file eq "-"); |
print "$file\n" unless ($file eq "-"); |
103 |
return "$file"; |
return "$file"; |
107 |
#dump_gif("NOVOSTI", TYPE_LINE, "-"); |
#dump_gif("NOVOSTI", TYPE_LINE, "-"); |
108 |
#exit $?; |
#exit $?; |
109 |
|
|
110 |
my $dbh = DBI->connect("DBI:Pg:dbname=plivasi", "", "") || |
# |
111 |
|
my $dbh = DBI->connect("DBI:Pg:dbname=plivasi", "dpavlin", "") || |
112 |
die $DBI::errstr; |
die $DBI::errstr; |
113 |
my $sth = $dbh->prepare("SELECT section,item,url,level,num FROM menu") || |
my $sth = $dbh->prepare("SELECT section,item,url,level,num FROM menu") || |
114 |
die $dbh->errstr(); |
die $dbh->errstr(); |