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 | ||
44ece581 | 16 | |
2674a73b PM |
17 | //Set the Content Type |
18 | header('Content-type: image/jpeg'); | |
19 | ||
44ece581 | 20 | // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300 |
ae5e4910 PM |
21 | $JPG = $_COOKIE['pJPG']; |
22 | $jpg_image = imagecreatefromjpeg($JPG); | |
2674a73b PM |
23 | |
24 | // Allocate A Color For The Text | |
4e86c3a9 | 25 | $black = imagecolorallocate($jpg_image, 0, 0, 0); |
2674a73b PM |
26 | |
27 | // Set Path to Font File | |
cba2e1ee | 28 | $font_path = 'files/coolvetica rg.ttf'; |
79cda33c | 29 | $font_path_sig = 'files/Claston Script.ttf'; |
2674a73b | 30 | |
c4b2d2ae | 31 | |
28c1c116 | 32 | $DOB = $_COOKIE['pDOB']; |
c4b2d2ae PM |
33 | $SIGNED = date('Y-m-d'); |
34 | ||
0b172b6c | 35 | if ($hide_county == 'NO'){ |
975d83fe | 36 | if ( $_COOKIE['pCOUNTY'] == 'Baltimore City' || $_COOKIE['debug'] == 'on'){ |
0b172b6c PM |
37 | // City Checkbox |
38 | $cord = $d['text_cord_cityX']; | |
39 | $array = explode(",",$cord); | |
40 | $debug = "$id : $cord : $array[0]"; | |
41 | imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, 'X'); | |
42 | }else{ | |
43 | // County on Petition | |
44 | $cord = $d['text_cord_county']; | |
45 | $array = explode(",",$cord); | |
46 | imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) ); | |
47 | } | |
609f4339 | 48 | } |
197e4a6c | 49 | // name |
0b172b6c | 50 | imagettftext($jpg_image, 50, 0, 350+$offset_x, 1070+$offset_y, $black, $font_path, $_COOKIE['pNAME']); |
a9e2a947 | 51 | //imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $debug); |
bbe86d85 | 52 | |
197e4a6c | 53 | // address |
0b172b6c | 54 | imagettftext($jpg_image, 50, 0, 400+$offset_x, 1300+$offset_y, $black, $font_path, $_COOKIE['pADDRESS']); |
b9943fb7 | 55 | // date of birth |
bbe86d85 | 56 | if($DOB != ''){ |
0b172b6c | 57 | imagettftext($jpg_image, 50, 0, 1900+$offset_x, 1070+$offset_y, $black, $font_path, date('m d Y',strtotime($DOB))); |
bbe86d85 PM |
58 | } |
59 | // date signed | |
4db02c88 | 60 | //imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED))); |
bbe86d85 PM |
61 | |
62 | ||
63 | // name | |
0b172b6c | 64 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2880+$offset_y_circulator, $black, $font_path, $_COOKIE['pNAME']); |
bbe86d85 | 65 | // address |
0b172b6c | 66 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 2975+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS1']); |
bbe86d85 | 67 | // city state zip |
0b172b6c | 68 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3065+$offset_y_circulator, $black, $font_path, $_COOKIE['pADDRESS2']); |
bbe86d85 | 69 | // phone |
0b172b6c | 70 | imagettftext($jpg_image, 40, 0, 100+$offset_x_circulator, 3160+$offset_y_circulator, $black, $font_path, $_COOKIE['pPHONE']); |
2514ea32 | 71 | |
197e4a6c | 72 | // date signed |
4db02c88 | 73 | //imagettftext($jpg_image, 40, 0, 2150, 3150, $black, $font_path, date('m / d / y',strtotime($SIGNED))); |
bbe86d85 | 74 | |
44ece581 | 75 | |
2674a73b PM |
76 | // Send Image to Browser |
77 | imagejpeg($jpg_image); | |
78 | ||
79 | // Clear Memory | |
80 | imagedestroy($jpg_image); | |
81 | ?> |