ขอบคุณทุกท่านครับ ตอนน้ผมเขียนได้แล้ว แต่ติดปัญหาตรงที่
ต้องการข้อความอยู่ตรงกลางว่า
"Welcome to Thailand
Thailand of Smile
Thank you for your visit"
ต้องเขียนเพิ่มตรงไหนครับ (จาก code ด้านล่าง)
และถ้ากำหนดตัวแปรเป็น
$String = "Welcome to Thailand
Thailand of Smile
Thank you for your visit"
บรรทุดก็ห่างเยอะมาก ต้องเขียนยังไงครับ รบกวนทีนะครับ

<?php
$height = 464;
$width = 464;
$fontsize = 50;
if (!isset($String))
$String = "Welcome to Thailand";
$im = ImageCreateFromJpeg("images/wall.jpg"); // Path Images
$blue = imagecolorallocate($im,0,0,255);
$green = imagecolorallocate($im,0,255,0);
$myfont = $_POST[fonts];
$font = "ANGORF.TTF";
$textwidth = $width;
while (1){
$box = imageTTFbbox( $fontsize, 0, $font, $String );
$textwidth = abs( $box[2] );
$textbodyheight = (abs($box[7]))-2;
if ( $textwidth < $width - 20 )
break;
$fontsize--;
}
$Xcenter = (int)($width/2 );
$Ycenter = (int)($height/2 );
imageTTFtext($im, $fontsize, 0,(int) ($Xcenter-($textwidth/2)),(int)($Ycenter+(($textbodyheight)/2) ), $blue, $font, $String );
imagegif($im,"images/img.jpg");
echo "<img src=images/img.jpg>";
?>