W trudzie i w mękach napisałem 2 podstrony: index.html i lol.php, które generują jpega z dynamicznym tekstem... A oto te strony:
Index:
Kod
<html>
<head><title>formularz</title>
</head>
<body>
<form action="lol.php" method="get">
Tekst, który się pojawi - <input name=pole1 type="text" /><br />
<input value="jazda" type="submit" />
</form>
</body>
</html>
<head><title>formularz</title>
</head>
<body>
<form action="lol.php" method="get">
Tekst, który się pojawi - <input name=pole1 type="text" /><br />
<input value="jazda" type="submit" />
</form>
</body>
</html>
lol.php:
Kod
<?php
function LoadJpeg($imgname)
{
$im = @imagecreatefromjpeg($imgname);
if (!$im) {
$im = imagecreatetruecolor(200, 30);
$bgc = imagecolorallocate($im, 0, 0, 0);
$tc = imagecolorallocate($im, 200, 200, 200);
imagefilledrectangle($im, 0, 0, 200, 30, $bgc);
imagestring($im, 1, 5, 5, "$_GET[pole1]", $tc);
}
return $im;
}
header("Content-Type: image/jpeg");
$img = LoadJpeg("lol.image");
imagejpeg($img);
?>
function LoadJpeg($imgname)
{
$im = @imagecreatefromjpeg($imgname);
if (!$im) {
$im = imagecreatetruecolor(200, 30);
$bgc = imagecolorallocate($im, 0, 0, 0);
$tc = imagecolorallocate($im, 200, 200, 200);
imagefilledrectangle($im, 0, 0, 200, 30, $bgc);
imagestring($im, 1, 5, 5, "$_GET[pole1]", $tc);
}
return $im;
}
header("Content-Type: image/jpeg");
$img = LoadJpeg("lol.image");
imagejpeg($img);
?>
I oto moje pytanie:
Jak w pliku lol.php zmienić kolor tła (0, 0, 0) na tło w formie obrazka, czyli np. cos.jpg??
Jak ktoś nie zrozumiał to napiszę to jescze raz...
