Update soft_copy.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
13 if ($_COOKIE['pVTRID'] != $d['VTRID']){
14 die('Error #294');
15 }
16
17 $q2 = "select * from VoterList where VTRID = '$d[VTRID]' ";
18 $r2 = $petition->query($q2);
19 $d2 = mysqli_fetch_array($r2);
20 $FIRSTNAME = $d2['FIRSTNAME'];
21 $MIDDLENAME = $d2['MIDDLENAME'];
22 $LASTNAME = $d2['LASTNAME'];
23 $RESIDENTIALCITY = $d2['RESIDENTIALCITY'];
24 $COUNTY = $d2['COUNTY'];
25 $RESIDENTIALZIP5 = $d2['RESIDENTIALZIP5'];
26 $full_name = "$FIRSTNAME $MIDDLENAME $LASTNAME";
27 $address = "$ADDRESS $RESIDENTIALCITY $RESIDENTIALZIP5";
28
29
30
31 // imagettftext ( resource $image , float $size , float $angle , int $x , int $y , int $color , string $fontfile , string $text )
32 // x how far from left
33 // y how far from top
34
35
36 //Set the Content Type
37 header('Content-type: image/jpeg');
38
39 // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
40 $jpg_image = imagecreatefromjpeg('files/Green-Party-petition-1-page-001.jpg');
41
42 // Allocate A Color For The Text
43 $black = imagecolorallocate($jpg_image, 0, 0, 0);
44
45 // Set Path to Font File
46 $font_path = 'files/coolvetica rg.ttf';
47 $font_path_sig = 'files/Claston Script.ttf';
48
49 if ( $COUNTY == 'Baltimore City'){
50 // City Checkbox
51 imagettftext($jpg_image, 50, 0, 115, 365, $black, $font_path, 'X');
52 }else{
53 // County on Petition
54 imagettftext($jpg_image, 50, 0, 220, 260, $black, $font_path, str_replace('County','',$COUNTY) );
55 }
56
57 // name
58 imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $full_name);
59 // signed
60 imagettftext($jpg_image, 60, 0, 400, 1180, $black, $font_path_sig, $full_name);
61 // address
62 imagettftext($jpg_image, 50, 0, 400, 1300, $black, $font_path, $address);
63 // date of birth
64 imagettftext($jpg_image, 50, 0, 1900, 1070, $black, $font_path, date('m d Y',strtotime($DOB)));
65 // date signed
66 imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED)));
67
68 // Send Image to Browser
69 imagejpeg($jpg_image);
70
71 // Clear Memory
72 imagedestroy($jpg_image);
73 ?>