summaryrefslogtreecommitdiff
path: root/DISCLAIMER.php
blob: e1c2b19241798b79d9b0faffda4266ac733d4617 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?

clearstatcache();

include "Config.php";
$Cache=CACHE_FOLDER."/Pictures/Maintenance.png";

if (   is_file($Cache)
   )
{
	$fd=fopen($Cache, "r");
	echo fread($fd, filesize($Cache));
	fclose($fd);
	exit;
}

class Text {
	var $width = 0;
	var $height = 0;
	var $x = 0;
	var $y = 0;

	var $font = "";
	var $size = 150; // High values to better quality
	var $angle = 2;
	var $color = 0;
	var $value = "";

	function initiate($size) {
		$this->x = 0;
		$this->width = abs(
			max($size[0], $size[2], $size[4], $size[6])
		  - min($size[0], $size[2], $size[4], $size[6])
		  );
		$this->height= abs(
		    max($size[1], $size[3], $size[5], $size[7])
		  - min($size[1], $size[3], $size[5], $size[7])
		  );

		$ratio = WIDTH / $this->width;

		$this->width = WIDTH;
		$this->height *= $ratio;
		$this->size = floor($this->size * $ratio);
	}
}
$Lines = array();
$Lines[] = new Text;

$Lines[0]->value = "New stuff available !";
$Lines[0]->angle = 2;
$Lines[] = new Text;
$Lines[1]->value = "Go get the latest badge";
$Lines[] = new Text;
$Lines[2]->value = "into my website";
$Lines[] = new Text;
$Lines[3]->value = "from NOW !";

foreach ($Lines as $Line)
	$Line->font = "import/Georgia";	

$y=0;
foreach ($Lines as $Line)
{
	$size=imageftbbox($Line->size, $Line->angle, $Line->font, $Line->value);
	$Line->initiate($size);
	$y+=$Line->height;
	$Line->y=$y;
}

$Image = new Text;
$Image->width   = WIDTH;
$Image->height  = $y;

$img=imagecreatetruecolor($Image->width, $Image->height);
imagealphablending($img, FALSE);
imagesavealpha($img, TRUE);

foreach ($Lines as $Line)
{
	$Line->color=imagecolorallocate($img, 0,
										  0,
										  0);
}

$transparent=imagecolorallocatealpha($img, 255, 255, 255, 127);

imagefilledrectangle($img, 0, 0, $Image->width, $Image->height, $transparent);

foreach ($Lines as $Line)
	imagettftext($img, $Line->size, $Line->angle, $Line->x, $Line->y, $Line->color, $Line->font, $Line->value);

imagepng($img);

if ($Cache != "") imagepng($img, $Cache);
imagedestroy($img);

?>