Dexxt3r Posted December 1, 2012 Share Posted December 1, 2012 I'm new to this type of thing, and really need some help i'm trying to place a Shadow on my text which is on a image. I found this Shadow code in the Php Manuel imagettftext: <?php // Set the content-type header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> And this is my in my script: $black = imagecolorallocate($img, R($htmlcolor), G($htmlcolor), B($htmlcolor)); /* Here you can make the color that u like Examples: $red = imagecolorallocate($img, 255, 0, 0); $blue = imagecolorallocate($img, 0, 0, 255); $yellow = imagecolorallocate($img, 255, 255, 0); $green = imagecolorallocate($img, 0, 255, 0); $black = imagecolorallocate($img, 0, 0, 0); */ //========================================================= $con = ConnectServer($server_ip,$server_port); if($con) { $dataNEW = GetData($con); //echo $data['hostname']; imagettftext($img, 10, 0, 8, 17, $black, $font, $dataNEW['hostname']); imagettftext($img, 8, 0, 7, 40, $black, $font, "GameMode: ".$dataNEW['gamemode']); imagettftext($img, 8, 0, 7, 55, $black, $font, "IP: ".$server_ip.":".$server_port); imagettftext($img, 8, 0, 7, 70, $black, $font, "Players: ".$dataNEW['players']."/".$dataNEW['maxplayers']); imagettftext($img, 8, 0, 7, 85, $black, $font, "Map: ".$dataNEW['mapname']); imagepng($img); } else { imagettftext($img, 8, 0, 150, 15, $black, $font,"This Server is offline..."); imagepng($img); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/271440-php-gd-shadow-on-text-help/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.