PHP关于这个imagettftext函数 生成的图片后的字不换行问题
PHP关于这个imagettftext函数 生成的图片不换行问题输入10个字正好。。输入大约10个以上的。。就一些字不显示了。
求方法/
只要一行不超过10个字就正常。/。超过10个就不行了,,多出来的就不显示了。
<?php
$text = $_POST["text"];
if ($text != "")
{
$text = explode("\r\n", $text);
$text_temp = "";
$t = 0;
foreach ($text as $key => $value)
{
$text_split = str_split($value, 100);
foreach ($text_split as $key_split => $value_split)
{
$text_temp[$t] = $value_split;
$t++;
}
}
$text = $text_temp;
$text_count = count($text);
$fontname = "方正小篆体.ttf";
$im = imagecreate(700, $text_count * 80);
$white = ImageColorAllocate($im, 255, 255, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
$red = ImageColorAllocate($im, 255, 0, 0);
for ($n = 0; $n < $text_count; $n++)
{
$value = $text[$n];
$value_length = strlen($value);
$value_count = 0;
for ($i = 0; $i < $value_length; $i++)
{
if (ord($value{$i}) > 100)
{
$value_count++;
}
}
if ($value_count % 2 != 0)
{
//$text[$n] = substr($value, 0, $value_length - 1);
//$text[$n + 1] = substr($value, -1, 1) . $text[$n + 1];
$text[$n] = $value . substr($text[$n + 1], 0, 1);
$text[$n + 1] = substr($text[$n + 1], 1, strlen($text[$n + 1]) - 1);
}
}
$text = implode("\r\n", $text);
for ($n = 0; $n <= 1; $n++)
{
ImageTTFText($im, 50, 0, 10, 70, $black, $fontname, iconv("GBK", "UTF-8", $text));
}
$dir = "images/";
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
if (filetype($dir . $file) == "file")
{
unlink($dir . $file);//删除文件
}
}
closedir($dh);
}
}
$file_name = $dir . md5($text) . ".png";
ImagePng($im, $file_name);
ImageDestroy($im);
}
else
{
$file_name = "welcome.png";
}
?>
<form id="form1" name="form1" method="post" action="">
<label>
<textarea name="text" cols="100" rows="15" id="text"></textarea>
<BR />
</label>
<label>
<input name="提交" type="submit" value="转换成篆书字体" /><BR />
</label>
</form><img src="<?= $file_name ?>" border="0">
要演示的地址可以呼我QQ。。我给你演示地址。。在这里发演示地址。问题就提不出来了,
追问:图片都不显示。。答案不是我要的。