output buffering
| From: | Kevin Waterson | Date: | Fri, 28 Feb 2003 02:07:37 +0000 |
| Subject: | output buffering | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-137496@lists.php.net to get a copy of this message | ||
I am having some problems with ob_*
My goals is basically this
<html>Stuff goes here
<?php header('Content-Type: image/jpeg'); echo
file_get_contents('img.jpg';?>
More stuff here</html>
The code below works until the showImage method is called, it does show the image
however, it does not output the 'Stuff goes here!' line.
any guidance greatfully recieved.
Code is below..
Kevin
<?php
class thumbs {
function thumbs(){
}
function showThumbs(){
return 'Thumbs';
}
function select(){
if(isset($_GET['show']))
{
return $this->showImage($_GET['show']);
}
else
{
return $buffer.$this->showThumbs();
}
}
function showImage(){
$size = getimagesize ('./australia.jpg');
if ($size)
{
header("Content-type: {$size['mime']}");
return file_get_contents('australia.jpg');
}
else
{
return ' was not found on this server';
}
}
} // end class
$thumbs = new thumbs;
ob_start(array($thumbs,'select'));
?>
<html>
Stuff goes here!
<?php
ob_end_flush();
?>
</html>
--
______
(_____ \
_____) ) ____ ____ ____ ____
| ____/ / _ ) / _ | / ___) / _ )
| | ( (/ / ( ( | |( (___ ( (/ /
|_| \____) \_||_| \____) \____)
Kevin Waterson
Port Macquarie, Australia