zedman3d
Fully Optimized
- Messages
- 2,850
PHP:
<?php
header('Content-type: image/png');
$text = $_GET['text'];
$im = imagecreatefrompng ("tech forums.png");
$color = imagecolorallocate($im,30,84,137);
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
$font = 'font.ttf';
$fontsize = 24;
$size = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string
$dx = (imagesx($im)) - (abs($size[2]-$size[0])); //calculate the location to start the text
$dx2 = (imagesx($im)) - (abs($size[2]-$size[0])) - 20; //calculate the location to start the text
imagettftext($im, $fontsize, 0, $dx, 35, imagecolorallocate($im,10,53,97), $font, 'Hey, ');
imagettftext($im, $fontsize, 0, $dx2, 35, $color, $font, $text);
imagepng($im);
imagedestroy($im);
?>
Just keep messing with that values ive changed until it works every time.