OK, in HTML:
HTML:
1
2
3
4
5
| <table border="0" cellpadding="0" cellspacing="0" width="140">
<tr>
<td width="100%">
<a href="http://www.eurobench.com/koersen.asp?page=exchange&bc=AEX">[img]"make_button.php?link=Eurobench"[/img]</a></td>
</tr></table> |
MAKE_BUTTON.PHP
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
| <?
$button_text = $link;
$im = imagecreatefrompng ("button.png");
$width_image = ImageSX($im);
$height_image = ImageSY($im);
$width_image_wo_margins = $width_image - (2 * 2);
$height_image_wo_margins = $height_image - (2 * 4);
$font_size = 33;
do
{
$font_size--;
$bbox=imagettfbbox ($font_size, 0, "arial.ttf", $button_text);
$right_text = $bbox[2];
$left_text = $bbox[0];
$width_text = $right_text - $left_text;
$height_text = abs($bbox[7] - $bbox[1]);
} while ( $font_size>8 &&
( $height_text>$height_image_wo_margins ||
$width_text>$width_image_wo_margins )
);
$text_x = $width_image/2.0 - $width_text/2.0;
$text_y = $height_image/2.0 - $height_text/2.0 ;
if ($left_text < 0)
$text_x += abs($left_text);
$above_line_text = abs($bbox[7]);
$text_y += $above_line_text;
$text_y -= 2;
$white = ImageColorAllocate ($im, 255, 255, 255);
ImageTTFText ($im, 12, 0, $text_x, $text_y, $white, "arial.ttf",
$button_text);
Header ("Content-type: image/png");
ImagePng ($im);
}
ImageDestroy ($im);
?> |
Win 2000 ADS -> Apache -> PHP 4.31
GD Info bij phpinfo()
-----------------------------------------
gd
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with TTF library
JPG Support enabled
PNG Support enabled
WBMP Support enabled
------------------------------------------------
Ja, sorry, 1e keer dat aan dit forum mee doe, super handig, ga eens neuzen of ik ook wat topics kan beantwoorden, mn specialiteiten liggen gewoon ergens anders
BTW spider, ik ben geinspirieerd
[
Voor 18% gewijzigd door
mr_wizard op 11-03-2003 17:32
]