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