在php中添加字符串和自动空格后的单词

时间:2015-04-18 08:03:07

标签: php

我的PHP代码是:

<?php
header('Content-type: image/jpeg');

$text = $_GET['name']"The text should be here" ;
$image_url="dump/".rawurlencode(trim($text)).".jpg";

// Check if the file doesn't exist, create it
if (!file_exists($image_url)) {   
    $jpg_image = imagecreatefromjpeg('Desert.jpg');
    $white = imagecolorallocate($jpg_image, 73, 41, 236);
    $font_path = 'OpenSans-Italic.TTF';
    imagettftext($jpg_image, 25, 0, 75, 50, $white, $font_path, $text);
    imagejpeg($jpg_image,$image_url);
    imagedestroy($jpg_image);
 }

 readfile($image_url);
?>

我的第一个问题是因为我从HTML文件获取输入并在图像上设置文本。我尝试使用$_GET['name']。之后,我想添加一些固定的文本,并在名称后面显示。此外,如果名称太长,则应自动设置其路径。

我面临的第二个问题是:假设我已经写了一个很长的段落,它应该显示在图像上,而我的图像大小只有713x400,那么我怎样才能自动输入以便文字会自动在下一行继续吗?

0 个答案:

没有答案