Update hard_copy.php
[clinton/MarylandElectronicPetitionSignature.git] / hard_copy.php
1 <?php
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
5 include_once('/var/www/secure.php');
6 $id = $_COOKIE['pID'];
7 $q = "select * from petitions where petition_id = '$id'";
8 $r = $petition->query($q);
9 $d = mysqli_fetch_array($r);
10
11 //Set the Content Type
12 header('Content-type: image/jpeg');
13
14 // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
15 $JPG = $_COOKIE['pJPG'];
16 $jpg_image = imagecreatefromjpeg($JPG);
17
18 // Allocate A Color For The Text
19 $black = imagecolorallocate($jpg_image, 0, 0, 0);
20
21 // Set Path to Font File
22 $font_path = 'files/coolvetica rg.ttf';
23 $font_path_sig = 'files/Claston Script.ttf';
24
25
26 $DOB = $_COOKIE['pDOB'];
27 $SIGNED = date('Y-m-d');
28
29 //if ( $_COOKIE['pCOUNTY'] == 'Baltimore City'){
30 // City Checkbox
31 $cord = $d['text_cord_cityX'];
32 $array = explode(",",$cord);
33 $debug = "$id : $cord : $array[0]";
34 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, 'X');
35 //}else{
36 // County on Petition
37 $cord = $d['text_cord_county'];
38 $array = explode(",",$cord);
39 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) );
40 //}
41
42 // name
43 imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $_COOKIE['pNAME']);
44 //imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $debug);
45
46 // address
47 imagettftext($jpg_image, 50, 0, 400, 1300, $black, $font_path, $_COOKIE['pADDRESS']);
48 // date of birth
49 if($DOB != ''){
50 imagettftext($jpg_image, 50, 0, 1900, 1070, $black, $font_path, date('m d Y',strtotime($DOB)));
51 }
52 // date signed
53 //imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED)));
54
55
56 // name
57 imagettftext($jpg_image, 40, 0, 100, 2880, $black, $font_path, $_COOKIE['pNAME']);
58 // address
59 imagettftext($jpg_image, 40, 0, 100, 2975, $black, $font_path, $_COOKIE['pADDRESS1']);
60 // city state zip
61 imagettftext($jpg_image, 40, 0, 100, 3065, $black, $font_path, $_COOKIE['pADDRESS2']);
62 // phone
63 imagettftext($jpg_image, 40, 0, 100, 3160, $black, $font_path, $_COOKIE['pPHONE']);
64
65 // date signed
66 //imagettftext($jpg_image, 40, 0, 2150, 3150, $black, $font_path, date('m / d / y',strtotime($SIGNED)));
67
68
69 // Send Image to Browser
70 imagejpeg($jpg_image);
71
72 // Clear Memory
73 imagedestroy($jpg_image);
74 ?>