-
Notifications
You must be signed in to change notification settings - Fork 4
/
qslprintmulti.php
170 lines (145 loc) · 4.42 KB
/
qslprintmulti.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
/*
Copyright 2017-2023 Jason D. McCormick
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
?>
<?php
include_once "qslconf.php";
include_once "qslprintpre.php";
# Intialize the ImageMagick item
$image = new Imagick($qsl_template_multi);
$image->setImageFormat('pdf');
# Draw the Callsign
$draw = new ImagickDraw();
$color = new ImagickPixel($qsl_c_font_color);
$draw->setFont($qsl_c_font);
$draw->setFontSize($qsl_c_font_size);
$draw->setFillColor($color);
$draw->setStrokeAntialias($qsl_c_font_aa);
$draw->setTextAntialias($qsl_c_font_aa);
if($qsl_callsign_center_gravity_multi){
$image->setGravity(imagick::GRAVITY_CENTER);
}
$draw->annotation($qsl_callsign_horiz_offset_multi, $qsl_callsign_vert_offset_multi, $call);
$image->drawImage($draw);
if($qsl_callsign_center_gravity_multi){
$image->setGravity(imagick::GRAVITY_NORTHWEST);
}
# Draw the QSO(s)
$draw = new ImagickDraw();
$color = new ImagickPixel($qsl_font_color);
$draw->setFont($qsl_font);
$draw->setFontSize($qsl_font_size);
$draw->setFillColor($color);
$draw->setStrokeAntialias($qsl_font_aa);
$draw->setTextAntialias($qsl_font_aa);
if($qsl_qso_center_gravity_multi){
$image->setGravity(imagick::GRAVITY_CENTER);
}
$lcount = 0;
while($row = $res->fetch_assoc()){
if($qsl_qso_verbose_rec_multi){
$freqband = "";
if(strlen($row['freq'] > 0)){
$freqband = sprintf("%.03f", $row['freq']);
} else {
$freqband = $row['band'];
}
$rst = "";
if(is_int(strlen($row['rstrcvd']))){
$rst = $row['rstrcvd'];
} else {
if(strcmp($row['mode'], "CW") or strcmp($row['mode'], "cw")){
$rst = "599";
} else {
$rst = "59";
}
}
$qstring = sprintf("%s %sZ Freq: %sMhz RST: %s Mode: %s",
$row['qsodate'], $row['timeon'], $freqband, $rst, $row['mode']);
if($qsl_qso_print_operator){
$qstring .= sprintf(" Oper: %s", $row['operator']);
}
if($qsl_qso_print_opercounty){
$qstring .= sprintf(" QTH: %s", $row['county']);
}
$draw->annotation($qsl_horiz_offset_multi,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier), $qstring);
} else {
# QSO Date
$draw->annotation(
$qsl_horiz_offset_multi,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$row['qsodate']
);
# QSO Time
$draw->annotation(
$qsl_horiz_offset_multi + $qsl_horiz_timeon_offset,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$row['timeon'] . "Z"
);
# QSO Band + Freq
$freqband = "";
if(strlen($row['freq'] > 0)){
$freqband = sprintf("%.03f", $row['freq']);
} else {
$freqband = $row['band'];
}
$draw->annotation(
$qsl_horiz_offset_multi + $qsl_horiz_band_offset,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$freqband
);
# QSO RST
$rst = "";
if(is_int(strlen($row['rstrcvd']))){
$rst = $row['rstrcvd'];
} else {
if(strcmp($row['mode'], "CW") or strcmp($row['mode'], "cw")){
$rst = "599";
} else {
$rst = "59";
}
}
$draw->annotation(
$qsl_horiz_offset_multi + $qsl_horiz_rst_offset_multi,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$rst
);
# QSO Mode
$draw->annotation(
$qsl_horiz_offset_multi + $qsl_horiz_mode_offset_multi,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$row['mode']
);
# QSO Operator
if($qsl_qso_print_operator_multi){
$draw->annotation(
$qsl_horiz_offset_multi + $qsl_horiz_operator_offset_multi,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$row['operator']
);
}
# QSO County
if($qsl_qso_print_opercounty_multi){
$draw->annotation(
$qsl_horiz_offset_multi + $qsl_horiz_county_offset_multi,
$qsl_vert_offset_multi + ($lcount * $qsl_multiline_multiplier),
$row['county']
);
}
}
$image->drawImage($draw);
$lcount++;
}
include_once("qslprintpost.php");
?>