मेरे पास एक स्क्रिप्ट है जो PHP का उपयोग कर टेक्स्ट से छवियां उत्पन्न करती है। यह ठीक काम कर रहा है सिवाय इसके कि मैं इसे अलग-अलग रंगों के साथ-साथ मल्टीलाइन टेक्स्ट भी उत्पन्न करना चाहता हूं। PHP, GD और Freetype का उपयोग करके यह कैसे किया जा सकता है? नीचे एक कोड है जिसका उपयोग मैं एकल पंक्ति पाठ छवियों को उत्पन्न करने के लिए करता हूं।PHP में टेक्स्ट से इमेज बनाना - मैं मल्टीलाइन कैसे बना सकता हूं?
$textval = 'This is some text to be an image';
$textcolor = '666666';
$font="arial.ttf";
$size = 9;
$padding= 1;
$bgcolor= "ffffff";
$transparent = 0;
$antialias = 0;
$fontfile = $fontpath.$font;
$box= imageftbbox($size, 0, $fontfile, $textval, array());
$boxwidth= $box[4];
$boxheight= abs($box[3]) + abs($box[5]);
$width= $boxwidth + ($padding*2) + 1;
$height= $boxheight + ($padding) + 0;
$textx= $padding;
$texty= ($boxheight - abs($box[3])) + $padding;
// create the image
$png= imagecreate($width, $height);
$color = str_replace("#","",$bgcolor);
$red = hexdec(substr($bgcolor,0,2));
$green = hexdec(substr($bgcolor,2,2));
$blue = hexdec(substr($bgcolor,4,2));
$bg = imagecolorallocate($png, $red, $green, $blue);
$color = str_replace("#","",$textcolor);
$red = hexdec(substr($textcolor,0,2));
$green = hexdec(substr($textcolor,2,2));
$blue = hexdec(substr($textcolor,4,2));
$tx = imagecolorallocate($png, $red, $green, $blue);
imagettftext($png, $size, 0, $textx, $texty, $tx, $fontfile, $textval);
header("content-type: image/jpeg");
imagejpeg($png);
imagedestroy($png);
exit;
मैं \ N लेकिन किसी कारण से यह भी रूप में यह :(है – Ali
हाय \ N प्रिंट होता है, तुम मेरे लिए, कैसे कस्टम छवि पृष्ठभूमि का उपयोग करने में मदद कर सकते उपयोग करने की कोशिश, मैं इस फ़ंक्शन का उपयोग कर कैप्चा बनाने की कोशिश कर रहा हूं – rkaartikeyan