dd62012c |
1 | <?php |
2 | |
3 | if (isset($_REQUEST["ecrire"])) |
4 | $ecrire = $_REQUEST["ecrire"]; |
5 | else $ecrire = "@"; |
6 | |
7 | $ecrire=str_rot13($ecrire); |
8 | |
9 | $fontsize = 10 ; |
10 | |
11 | $font = "/Applications/MAMP/htdocs/forumheracles/Vera.ttf" ; |
12 | $angle = 0 ; |
13 | $size = ImageTTFBBox( $fontsize, $angle, $font, $ecrire ) ; |
14 | |
15 | $widthExtra = $size[2] * 0.025 ; |
16 | $width = round( $size[2] + $widthExtra ) ; |
17 | $widthExtra = round( $widthExtra ) ; |
18 | |
19 | $heightExtra = ( abs( $size[5] ) + $size[3] ) * 0.15 ; |
20 | $height = abs( $size[5] ) + $size[3] + $heightExtra ; |
21 | $heightExtra = round( $heightExtra ) ; |
22 | |
23 | $text_x = round( $widthExtra / 2 ) ; |
24 | $text_y = abs( $size[5] ) + round( $heightExtra / 2 ) ; |
25 | |
26 | $im = imagecreate( $width+2, $height+2) ; |
27 | $bkgc = ImageColorAllocate( $im, 255, 255, 255 ) ; |
28 | $txtc = ImageColorAllocate( $im, 0, 0, 0 ) ; |
29 | ImageTTFText( $im, $fontsize, $angle, $text_x, $text_y, $txtc, $font, $ecrire ) ; |
30 | |
31 | Header( "Content-type: image/gif" ) ; |
32 | Imagejpeg( $im ) ; |
33 | ImageDestroy( $im ) ; |
34 | |
35 | ?> |