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