0

所以我想弄清楚如何做到这一点:http ://www.hetemeel.com/einsteinform.php 与我自己的形象。我还需要弄清楚如何用从 SQL 数据库中获取文本来替换文本框。任何帮助深表感谢。谢谢!:-)

4

2 回答 2

2

尝试使用此脚本。

$sql = "SELECT some_text FROM some_table LIMIT 1";
$rs = mysql_query($sql) or die();
$arr = mysql_fetch_assoc($rs);

header ("Content-type: image/png");
$string = $arr['some_text'];
// try changing this as well
$font = 4;
$width = imagefontwidth($font) * strlen($string) ;
$height = imagefontheight($font) ;
$im = imagecreatefrompng("/path/to/someimagefile");
$x = imagesx($im) - $width ;
$y = imagesy($im) - $height;
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 0, 0,0);
imagestring ($im, $font, $x, $y,  $string, $textColor);
imagepng($im);
于 2011-06-18T08:30:55.253 回答
1

首先,将此图像作为 div 的背景图像,对于图像中显示的文本,您可以使用 CSS3 将文本转换为您所看到的方式:

-webkit-transform: rotate(15deg); /* rotate the text by 15 degree for chrome */
-moz-transform: rotate(15deg); /* for mozilla */
transform: rotate(15deg); /* for future, when css3 is standard and Opera */

并使用一种字体给它一种像“Buxton Sketch”字体名称一样手写的感觉。然后使用该文本的 padding-left 属性在图像中以您想要的方式定位它。

我希望这会有用。

于 2011-06-18T08:43:25.137 回答