View Single Post
Old 12-31-2008, 10:04 AM   #11 (permalink)
kokjj87
The Wanderer
 
kokjj87's Avatar
 
Join Date: Oct 2008
Posts: 18
Thanks: 0
kokjj87 is on a distinguished road
Default

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($image255255255);

            
$fontColor imagecolorallocate($image000);

            
$startX     15;
            
$startY     5;
            
$string "$variable";
            
imagestring($image3$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.
kokjj87 is offline  
Reply With Quote