| 1 | <?php | 
|---|
| 2 | include('code.php'); | 
|---|
| 3 |  | 
|---|
| 4 | if(array_key_exists('b', $_GET)) $Image3 = ImageCreateFromPNG("ButtonBright.png"); | 
|---|
| 5 | else $Image3 = imagecreatefrompng("Button.png"); | 
|---|
| 6 |  | 
|---|
| 7 | $Image = ImageCreate(imagesx($Image3) * 1.5, imagesy($Image3) * 1.5); | 
|---|
| 8 | imagecopyresampled($Image, $Image3, 0, 0, 0, 0, imagesx($Image), imagesy($Image), imagesx($Image3), imagesy($Image3)); | 
|---|
| 9 | ImageDestroy($Image3); | 
|---|
| 10 |  | 
|---|
| 11 | if(array_key_exists('text', $_GET)) $Text = $_GET['text']; | 
|---|
| 12 | else $Text = 'Arény'; | 
|---|
| 13 |  | 
|---|
| 14 | $FontFile = 'FRIZQT__.ttf'; | 
|---|
| 15 | //$FontFile = 'c:\WINDOWS\fonts\arial.ttf'; | 
|---|
| 16 | $FontSize = 20; | 
|---|
| 17 | $FontSizeShadow = $FontSize * 1.3; | 
|---|
| 18 |  | 
|---|
| 19 | $white = imagecolorallocate($Image, 255, 255, 255); | 
|---|
| 20 | $grey = imagecolorallocate($Image, 200, 200, 200); | 
|---|
| 21 | $black = imagecolorallocate($Image, 30, 30, 30); | 
|---|
| 22 |  | 
|---|
| 23 | $BoundBox = imagettfbbox($FontSizeShadow, 0, $FontFile, $Text); | 
|---|
| 24 | $ShadowTextPositionY = imagesy($Image) / 2 + ($BoundBox[1] - $BoundBox[7]) / 2 - 2; | 
|---|
| 25 | $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text); | 
|---|
| 26 | $TextPositionY = imagesy($Image) / 2 + ($BoundBox[1] - $BoundBox[7]) / 2 - 2; | 
|---|
| 27 | $SizeX = array(); | 
|---|
| 28 | for($I = 0; $I < strlen($Text);$I++) | 
|---|
| 29 | { | 
|---|
| 30 | $BoundBox = imagettfbbox($FontSizeShadow, 0, $FontFile, $Text{$I}); | 
|---|
| 31 | $SizeX[$I] = ($BoundBox[2] - $BoundBox[0]); | 
|---|
| 32 | } | 
|---|
| 33 |  | 
|---|
| 34 | $PositionX = imagesx($Image) / 2 - array_sum($SizeX) / 2; | 
|---|
| 35 | for($I=0; $I<strlen($Text); $I++) | 
|---|
| 36 | { | 
|---|
| 37 | $PositionX += $SizeX[$I] / 2; | 
|---|
| 38 | $BoundBox = imagettfbbox($FontSizeShadow, 0, $FontFile, $Text{$I}); | 
|---|
| 39 | $TextPositionX = $PositionX - ($BoundBox[2] - $BoundBox[0]) / 2; | 
|---|
| 40 | ImageTTFText($Image, $FontSizeShadow, 0, $TextPositionX, $ShadowTextPositionY, $black, $FontFile, $Text{$I}); | 
|---|
| 41 | $BoundBox = imagettfbbox($FontSize, 0, $FontFile, $Text{$I}); | 
|---|
| 42 | $TextPositionX = $PositionX - ($BoundBox[2] - $BoundBox[0]) / 2; | 
|---|
| 43 | ImageTTFText($Image, $FontSize, 0, $TextPositionX, $TextPositionY, $grey, $FontFile, $Text{$I}); | 
|---|
| 44 | $PositionX += $SizeX[$I] / 2; | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | $Image2 = ImageCreateTrueColor(125, 27); | 
|---|
| 48 | imagecopyresampled($Image2, $Image, 0, 0, 0, 0, imagesx($Image2), imagesy($Image2), imagesx($Image), imagesy($Image)); | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | header("Content-type: image/jpeg"); | 
|---|
| 53 | ImageJpeg($Image2); | 
|---|
| 54 | ImageDestroy($Image); | 
|---|
| 55 | ImageDestroy($Image2); | 
|---|
| 56 |  | 
|---|
| 57 | ?> | 
|---|