plusset skal være i midten gdlib
HejsaPrøv at se på www.testtest.test.fuckingloveyou.com, der kan i godt se det ser lidt dumt ud at plusset (+) ikke er i midten, hvordan kan jeg få lavet så det er det?
Min kode ser således ud:
<?php
// Set the content-type
header("Content-type: image/png");
// Create the image
$im = imagecreatefromjpeg("heart.jpg");
// Create some colors
$grey = imagecolorallocate($im, 128, 128, 128);
$white = imagecolorallocate($im, 250, 250, 250);
// The text to draw
if(!empty($_GET['name1']) && !empty($_GET['name2'])) {
$name = strtoupper($_GET['name1']).' + '.strtoupper($_GET['name2']);
}
$text = '4EVER';
// Replace path by your own font path
$font = 'AGENCYR.TTF';
$sw = imagesx( $im );
$box = imagettfbbox( 30, 0, $font, $text );
$bw = abs( $box[4] - $box[0] );
// Add some shadow to the text
$posX = ( $sw - $bw ) / 2;
imagettftext($im, 30, 0, $posX+1, 251, $grey, $font, $text);
// Add the text
imagettftext($im, 30, 0, $posX, 250, $white, $font, $text);
$box = imagettfbbox( 60, 0, $font, $name );
$bw = abs( $box[4] - $box[0] );
// Add some shadow to the text
$posX = ( $sw - $bw ) / 2;
imagettftext($im, 60, 0, $posX+1, 191, $grey, $font, $name);
// Add the text
imagettftext($im, 60, 0, $posX, 191, $white, $font, $name);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
