Update petition.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
6
7 //Set the Content Type
8 header('Content-type: image/jpeg');
9
10 // Create Image From Existing File -- going to have to make this a reqired size??? 2550x3300
11 $jpg_image = imagecreatefromjpeg('files/Green-Party-petition-1-page-001.jpg');
12
13 // Allocate A Color For The Text
14 $black = imagecolorallocate($jpg_image, 0, 0, 0);
15
16 // Set Path to Font File
17 $font_path = 'files/coolvetica rg.ttf';
18 $font_path_sig = 'files/Claston Script.ttf';
19
20 if ( $_COOKIE['pCOUNTY'] == 'Baltimore City'){
21 // City Checkbox
22 imagettftext($jpg_image, 50, 0, 115, 365, $black, $font_path, 'X');
23 }else{
24 // County on Petition
25 imagettftext($jpg_image, 50, 0, 220, 260, $black, $font_path, str_replace('County','',$_COOKIE['pCOUNTY']) );
26 }
27
28 // name
29 imagettftext($jpg_image, 50, 0, 350, 1070, $black, $font_path, $_COOKIE['pNAME']);
30 // signed
31 // imagettftext($jpg_image, 60, 0, 400, 1180, $black, $font_path_sig, $_COOKIE['pNAME']);
32 // address
33 imagettftext($jpg_image, 50, 0, 400, 1300, $black, $font_path, $_COOKIE['pADDRESS']);
34 // date of birth
35 imagettftext($jpg_image, 50, 0, 1900, 1070, $black, $font_path, date('m d Y',strtotime( $_COOKIE['pDOB'])));
36 // date signed
37 imagettftext($jpg_image, 50, 0, 1900, 1200, $black, $font_path, date('m d Y'));
38
39 // Send Image to Browser
40 imagejpeg($jpg_image);
41
42 // Clear Memory
43 imagedestroy($jpg_image);
44 ?>