cards.php
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/***********************
Made by: Yearupie
Made on: 14 May 2010
***********************/
$soorten = array(
1 => '♠',# Schoppen
2 => '♣', # Klaveren
3 => '♥',# Harten
4 => '♦');# Ruiten
$types = array(
1 => 'A', # Aas
11 => 'B', # Boer
12 => 'V', # Vrouw
13 => 'K');# Koning
if(isset($_GET['soort'],$_GET['getal']) AND ctype_digit($_GET['soort']) AND ctype_digit($_GET['getal']) AND $_GET['soort'] >= 1 AND $_GET['soort'] <= 4 AND $_GET['getal'] >= 1 AND $_GET['getal'] <= 13):
header("Content-type: image/png");
$im = @imagecreate(50, 100)
or die("Cannot Initialize new GD image stream");
// Set background color
$background_color = imagecolorallocatealpha($im, 255, 255, 255, 0);
// Set font color
$text_color = ($_GET['soort'] > 2) ? imagecolorallocate($im, 255, 0, 0) : imagecolorallocate($im, 0, 0, 0);
// Set x from number
$left = ($_GET['getal'] == 10) ? 10 : 20;
// Set numbers
$getal = ($_GET['getal'] <= 10) ? (($_GET['getal'] != 1) ? $_GET['getal'] : $types[$_GET['getal']]) : $types[$_GET['getal']];
// Replace path by your own font path
$font = 'fonts/arial.ttf';
// Make border lines
imageline($im, 5, 0, 45, 0, $text_color);
imageline($im, 49, 5, 49, 95, $text_color);
imageline($im, 45, 99, 5, 99, $text_color);
imageline($im, 0, 5, 0, 95, $text_color);
// Make border angles
imagearc ($im , 45 , 95 , 10 , 10 , 0 , 90 , $text_color);
imagearc ($im , 4 , 95 , 10 , 10 , 90 , 180 , $text_color);
imagearc ($im , 4 , 4 , 10 , 10 , 180 , 270 , $text_color);
imagearc ($im , 45 , 4 , 10 , 10 , 270 , 0 , $text_color);
// Color of the card
imagefill($im, 5, 5, imagecolorallocate($im, 255, 255, 255));
// Set type
imagettftext($im, 20, 0, 0, 17, $text_color, $font, $soorten[$_GET['soort']]);
imagettftext($im, 20, 180, 50, 82, $text_color, $font, $soorten[$_GET['soort']]);
// Set number
imagettftext($im, 20, 0, $left, 60, $text_color, $font, $getal);
imagepng($im);
imagedestroy($im);
endif;
?>
/***********************
Made by: Yearupie
Made on: 14 May 2010
***********************/
$soorten = array(
1 => '♠',# Schoppen
2 => '♣', # Klaveren
3 => '♥',# Harten
4 => '♦');# Ruiten
$types = array(
1 => 'A', # Aas
11 => 'B', # Boer
12 => 'V', # Vrouw
13 => 'K');# Koning
if(isset($_GET['soort'],$_GET['getal']) AND ctype_digit($_GET['soort']) AND ctype_digit($_GET['getal']) AND $_GET['soort'] >= 1 AND $_GET['soort'] <= 4 AND $_GET['getal'] >= 1 AND $_GET['getal'] <= 13):
header("Content-type: image/png");
$im = @imagecreate(50, 100)
or die("Cannot Initialize new GD image stream");
// Set background color
$background_color = imagecolorallocatealpha($im, 255, 255, 255, 0);
// Set font color
$text_color = ($_GET['soort'] > 2) ? imagecolorallocate($im, 255, 0, 0) : imagecolorallocate($im, 0, 0, 0);
// Set x from number
$left = ($_GET['getal'] == 10) ? 10 : 20;
// Set numbers
$getal = ($_GET['getal'] <= 10) ? (($_GET['getal'] != 1) ? $_GET['getal'] : $types[$_GET['getal']]) : $types[$_GET['getal']];
// Replace path by your own font path
$font = 'fonts/arial.ttf';
// Make border lines
imageline($im, 5, 0, 45, 0, $text_color);
imageline($im, 49, 5, 49, 95, $text_color);
imageline($im, 45, 99, 5, 99, $text_color);
imageline($im, 0, 5, 0, 95, $text_color);
// Make border angles
imagearc ($im , 45 , 95 , 10 , 10 , 0 , 90 , $text_color);
imagearc ($im , 4 , 95 , 10 , 10 , 90 , 180 , $text_color);
imagearc ($im , 4 , 4 , 10 , 10 , 180 , 270 , $text_color);
imagearc ($im , 45 , 4 , 10 , 10 , 270 , 0 , $text_color);
// Color of the card
imagefill($im, 5, 5, imagecolorallocate($im, 255, 255, 255));
// Set type
imagettftext($im, 20, 0, 0, 17, $text_color, $font, $soorten[$_GET['soort']]);
imagettftext($im, 20, 180, 50, 82, $text_color, $font, $soorten[$_GET['soort']]);
// Set number
imagettftext($im, 20, 0, $left, 60, $text_color, $font, $getal);
imagepng($im);
imagedestroy($im);
endif;
?>