【发布时间】:2012-04-25 21:03:32
【问题描述】:
这是我的网站。我正在尝试制作自己的测试网址:
http://boats.instantonlinesuccess.co.uk/boat-names.html
如果你看它,你就会明白我在做什么。我正在尝试将 JavaScript 链接到我的 PHP,因此文字会出现效果/效果颜色/颜色。这一切都是通过我正在尝试编写的 PHP 脚本生成的。
这是我的 PHP:
<?php header("Content-type: image/png");
$string = $_GET['text'];
$currentFont =$_GET['font'];
$currentTextColour = $_GET['colour'];
$currentEffect = $_GET['effect'];
$currentEffectColour = $_GET['effectcolour'];
$im = imagecreatefrompng("images/test.png");
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
//if you exactly know the RGB color indexes//
$rgb = imagecolorexact($im, 0, 0, 0);
//or keep the rgb color by position so at top 0 left 0
$rgb = imagecolorat($im, 0, 0);
imagecolortransparent($im, $rgb);
imagestring($im, 64, $px, 16, $string, $currentTextColour);
imagepng($im); imagedestroy($im);
?>
如果您需要 JavaScript,请告诉我。
【问题讨论】:
-
能否让您的标题具有描述性?
-
请在您的代码块中使用适当的换行符。您不必为每行付费。
-
您可以尝试将第一行更改为此来调试问题:那是真的 header('Content-Type: text/plain');
标签: php javascript gd