Update hard_copy.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'];
7$q = "select * from petitions where id = '$id'";
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
b9943fb7
PM
29if ( $_COOKIE['pCOUNTY'] == 'Baltimore City'){
30 // City Checkbox
accc420d
PM
31 $cord = $d['text_cord_county'];
32 $array = explode(",",$cord);
33 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, 'X');
b9943fb7
PM
34}else{
35 // County on Petition
accc420d
PM
36 $cord = $d['text_cord_cityX'];
37 $array = explode(",",$cord);
38 imagettftext($jpg_image, $array[0], $array[1], $array[2], $array[3], $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) );
b9943fb7 39}
44ece581 40
197e4a6c 41// name
b9943fb7 42imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $_COOKIE['pNAME']);
bbe86d85 43
197e4a6c 44// address
b9943fb7
PM
45imagettftext($jpg_image, 50, 0, 400, 1300, $black, $font_path, $_COOKIE['pADDRESS']);
46// date of birth
bbe86d85
PM
47if($DOB != ''){
48 imagettftext($jpg_image, 50, 0, 1900, 1070, $black, $font_path, date('m d Y',strtotime($DOB)));
49}
50// date signed
4db02c88 51//imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y',strtotime($SIGNED)));
bbe86d85
PM
52
53
54// name
bab34e65 55imagettftext($jpg_image, 40, 0, 100, 2880, $black, $font_path, $_COOKIE['pNAME']);
bbe86d85 56// address
89d9aa01 57imagettftext($jpg_image, 40, 0, 100, 2975, $black, $font_path, $_COOKIE['pADDRESS1']);
bbe86d85 58// city state zip
89d9aa01 59imagettftext($jpg_image, 40, 0, 100, 3065, $black, $font_path, $_COOKIE['pADDRESS2']);
bbe86d85 60// phone
bab34e65 61imagettftext($jpg_image, 40, 0, 100, 3160, $black, $font_path, $_COOKIE['pPHONE']);
2514ea32 62
197e4a6c 63// date signed
4db02c88 64//imagettftext($jpg_image, 40, 0, 2150, 3150, $black, $font_path, date('m / d / y',strtotime($SIGNED)));
bbe86d85 65
44ece581 66
2674a73b
PM
67// Send Image to Browser
68imagejpeg($jpg_image);
69
70// Clear Memory
71imagedestroy($jpg_image);
72?>