01-01-2009, 08:44 PM
|
#14 (permalink)
|
|
The Contributor
Join Date: Sep 2008
Location: Miami
Posts: 39
Thanks: 7
|
Quote:
Originally Posted by kokjj87
You can't have both html and picture render in the same page, because the header("Content-type: image/jpeg"); header would tell the browser to render it as a jpg page, instead of a html page..
In order to get this working, you need to separate this 2 file.
//The image file
PHP Code:
<?php
$text = $_GET['text'];
class image
{
public function text($variable)
{
$image = imagecreate(200,25);
imagecolorallocate($image, 255, 255, 255);
$fontColor = imagecolorallocate($image, 0, 0, 0);
$startX = 15;
$startY = 5;
$string = "$variable";
imagestring($image, 3, $startX, $startY, $string, $fontColor);
header("Content-type: image/jpeg");
imagejpeg($image);
imagedestroy($image);
}
}
$image = new image();
echo $image->text($text);
?>
//the html page
PHP Code:
<?php
echo 'this is the html page.<br/>';
echo '<img src="PATHTOTHEIMAGEFILE?text=YOUR TEXT HERE"/>';
?>
Since your are parsing a email, so it is quite sensitive, so rather than passing the email as the parameter, i would recommend you to query the database and get the email for parsing on your image side.
|
I see what you are saying, but im basically trying to use this string to generate text into image , not to watermark images.
|
|
|