Commit | Line | Data |
---|---|---|
2674a73b | 1 | <?php |
44ece581 PM |
2 | // imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text ) |
3 | // x how far from left | |
4 | // y how far from top | |
accc420d PM |
5 | include_once('/var/www/secure.php'); |
6 | $id = $_COOKIE['pID']; | |
a9e2a947 | 7 | $q = "select * from petitions where petition_id = '$id'"; |
accc420d PM |
8 | $r = $petition->query($q); |
9 | $d = mysqli_fetch_array($r); | |
0b172b6c PM |
10 | $hide_county = $d['hide_county_on_petition']; |
11 | $offset_x = $d['offset_x_cords']; | |
12 | $offset_y = $d['offset_y_cords']; | |
13 | $offset_x_circulator = $d['offset_x_cords_circulator']; | |
14 | $offset_y_circulator = $d['offset_y_cords_circulator']; | |
15 | ||
d21ab5a1 PM |
16 | $petition_party_line1 = $d['petition_party_line1']; |
17 | $petition_party_line2 = $d['petition_party_line2']; | |
18 | $petition_party_line3 = $d['petition_party_line3']; | |
44f7b848 | 19 | $petition_party_line4 = $d['petition_party_line4']; |
d21ab5a1 | 20 | |
44ece581 | 21 | |
2674a73b PM |
22 | //Set the Content Type |
23 | header('Content-type: image/jpeg'); | |
24 | ||
44ece581 | 25 | // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300 |
ae5e4910 PM |
26 | $JPG = $_COOKIE['pJPG']; |
27 | $jpg_image = imagecreatefromjpeg($JPG); | |
2674a73b PM |
28 | |
29 | // Allocate A Color For The Text | |
4e86c3a9 | 30 | $black = imagecolorallocate($jpg_image, 0, 0, 0); |
2674a73b PM |
31 | |
32 | // Set Path to Font File | |
cba2e1ee | 33 | $font_path = 'files/coolvetica rg.ttf'; |
79cda33c | 34 | $font_path_sig = 'files/Claston Script.ttf'; |
2674a73b | 35 | |
c4b2d2ae | 36 | |
28c1c116 | 37 | $DOB = $_COOKIE['pDOB']; |
c4b2d2ae PM |
38 | $SIGNED = date('Y-m-d'); |
39 | ||
0b172b6c | 40 | if ($hide_county == 'NO'){ |
975d83fe | 41 | if ( $_COOKIE['pCOUNTY'] == 'Baltimore City' || $_COOKIE['debug'] == 'on'){ |
0b172b6c PM |
42 | // City Checkbox |
43 | $cord = $d['text_cord_cityX']; | |
44 | $array = explode(",",$cord); | |
45 | $debug = "$id : $cord : $array[0]"; | |
46 | imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, 'X'); | |
47 | }else{ | |
48 | // County on Petition | |
49 | $cord = $d['text_cord_county']; | |
50 | $array = explode(",",$cord); | |
51 | imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) ); | |
52 | } | |
609f4339 | 53 | } |
44f7b848 PM |
54 | |
55 | // Party Information | |
f89d953e | 56 | imagettftext($jpg_image, 50, 0, 200, 580, $black, $font_path, $petition_party_line1 ); |
fdc779f2 PM |
57 | imagettftext($jpg_image, 50, 0, 700, 700, $black, $font_path, $petition_party_line2 ); |
58 | imagettftext($jpg_image, 50, 0, 340, 790, $black, $font_path, $petition_party_line3 ); | |
f89d953e | 59 | imagettftext($jpg_image, 50, 0, 340, 870, $black, $font_path, $petition_party_line4 ); |
44f7b848 PM |
60 | |
61 | ||
62 | ||
197e4a6c | 63 | // name |
0b172b6c | 64 | imagettftext($jpg_image, 50, 0, 350+$offset_x, 1070+$offset_y, $black, $font_path, $_COOKIE['pNAME']); |
a9e2a947 | 65 | //imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $debug); |
bbe86d85 | 66 | |
197e4a6c | 67 | // address |
0b172b6c | 68 | imagettftext($jpg_image, 50, 0, 400+$offset_x, 1300+$offset_y, $black, $font_path, $_COOKIE['pADDRESS']); |
b9943fb7 | 69 | // date of birth |
bbe86d85 | 70 | if($DOB != ''){ |
0b172b6c | 71 | imagettftext($jpg_image, 50, 0, 1900+$offset_x, 1070+$offset_y, $black, $font_path, date('m d Y',strtotime($DOB))); |
bbe86d85 PM |
72 | } |
73 | // date signed | |
4db02c88 | 74 | //imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED))); |
bbe86d85 PM |
75 | |
76 | ||
77 | // name | |
0b172b6c | 78 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2880+$offset_y_circulator, $black, $font_path, $_COOKIE['pNAME']); |
bbe86d85 | 79 | // address |
0b172b6c | 80 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2975+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS1']); |
bbe86d85 | 81 | // city state zip |
0b172b6c | 82 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3065+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS2']); |
bbe86d85 | 83 | // phone |
0b172b6c | 84 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path, $_COOKIE['pPHONE']); |
2514ea32 | 85 | |
197e4a6c | 86 | // date signed |
4db02c88 | 87 | //imagettftext($jpg_image, 40, 0, 2150, 3150, $black, $font_path, date('m / d / y',strtotime($SIGNED))); |
bbe86d85 | 88 | |
44ece581 | 89 | |
2674a73b PM |
90 | // Send Image to Browser |
91 | imagejpeg($jpg_image); | |
92 | ||
93 | // Clear Memory | |
94 | imagedestroy($jpg_image); | |
95 | ?> |