please let me know if you know how to develop what I really want to do.
I have a code which creates an image (similar to a captcha) like this :
/* createImg.php */
class createImg{
public function __construct(){
/*stuff here*/
}
public function showImg(){
/*stuff here*/
header("Content-type: image/png");
imagepng($image);
imagedestroy($image);
}
}
$img = new createImg();
$img->showImg();
And what I do to create the image is something like :
/* index.php */
echo '<img src="createImg.php" />';
Everything works fine but what I would like to do is the following thing but I don“t know how to implement it:
/* index.php */
$img = new createImg();
//and now something like this
echo '<img src="$img->showImg()" />';
The problem I get is that, if I use this way, I got the image in the main screen due to the header in the function. Is there any way to do what I want to do ?