Update share.php
[clinton/MarylandElectronicPetitionSignature.git] / soft_copy.php
1 <?php
2 include_once('/var/www/secure.php');
3
4 $id = $_GET['id'];
5 $q = "select * from signatures where id = '$id' ";
6 $r = $petition->query($q);
7 $d = mysqli_fetch_array($r);
8
9 $DOB = $d['date_of_birth'];
10 $SIGNED = $d['date_time_signed'];
11 $PETITION_ID = $d['petition_id'];
12 $signed_name_as = $d['signed_name_as'];
13 $signed_name_as_circulator = $d['signed_name_as_circulator'];
14 if ($_COOKIE['pVTRID'] != $d['VTRID']){
15 die('Error #294');
16 }
17
18 $q2 = "select * from VoterList where VTRID = '$d[VTRID]' ";
19 $r2 = $petition->query($q2);
20 $d2 = mysqli_fetch_array($r2);
21 $FIRSTNAME = $d2['FIRSTNAME'];
22 $MIDDLENAME = $d2['MIDDLENAME'];
23 $LASTNAME = $d2['LASTNAME'];
24 $ADDRESS = $d2['ADDRESS'];
25 $RESIDENTIALCITY = $d2['RESIDENTIALCITY'];
26 $COUNTY = $d2['COUNTY'];
27 $RESIDENTIALZIP5 = $d2['RESIDENTIALZIP5'];
28 $full_name = "$FIRSTNAME $MIDDLENAME $LASTNAME";
29 $address = "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5";
30
31 $contact_phone = $d2['contact_phone'];
32
33
34 $qX = "select * from petitions where petition_id = '$PETITION_ID'";
35 $rX = $petition->query($qX);
36 $dX = mysqli_fetch_array($rX);
37
38 // imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
39 // x how far from left
40 // y how far from top
41
42
43 //Set the Content Type
44 header('Content-type: image/jpeg');
45
46 // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
47 $jpg_image = imagecreatefromjpeg($dX['petition_jpg']);
48
49 // Allocate A Color For The Text
50 $black = imagecolorallocate($jpg_image, 0, 0, 0);
51
52 // Set Path to Font File
53 $font_path = 'files/coolvetica rg.ttf';
54 $font_path_sig = 'files/Claston Script.ttf';
55
56 if ( $_COOKIE['pCOUNTY'] == 'Baltimore City'){
57 // City Checkbox
58 $cord = $dX['text_cord_cityX'];
59 $array = explode(",",$cord);
60 $debug = "$id : $cord : $array[0]";
61 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, 'X');
62 }else{
63 // County on Petition
64 $cord = $dX['text_cord_county'];
65 $array = explode(",",$cord);
66 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) );
67 }
68
69 // name
70 imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $full_name);
71 // signed
72 imagettftext($jpg_image, 70, 0, 400, 1180, $black, $font_path_sig, $signed_name_as);
73 // address
74 imagettftext($jpg_image, 50, 0, 400, 1300, $black, $font_path, $address);
75
76 // date of birth
77 if($DOB != ''){
78 imagettftext($jpg_image, 50, 0, 1900, 1070, $black, $font_path, date('m d Y',strtotime($DOB)));
79 }
80 // date signed
81 imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED)));
82
83
84 // name
85 imagettftext($jpg_image, 40, 0, 100, 2880, $black, $font_path, $_COOKIE['pNAME']);
86 // address
87 imagettftext($jpg_image, 40, 0, 100, 2975, $black, $font_path, $_COOKIE['pADDRESS1']);
88 // city state zip
89 imagettftext($jpg_image, 40, 0, 100, 3065, $black, $font_path, $_COOKIE['pADDRESS2']);
90 // phone
91 imagettftext($jpg_image, 40, 0, 100, 3160, $black, $font_path, $_COOKIE['pPHONE']);
92 // signed
93 imagettftext($jpg_image, 70, 0, 1290, 3160, $black, $font_path_sig, $signed_name_as_circulator);
94 // date signed
95 imagettftext($jpg_image, 50, 0, 2150, 3160, $black, $font_path, date('m / d / y',strtotime($SIGNED)));
96
97
98
99 // Send Image to Browser
100 imagejpeg($jpg_image);
101
102 // Clear Memory
103 imagedestroy($jpg_image);
104 ?>