Re: output buffering
| From: | Leif K-Brooks | Date: | Fri, 28 Feb 2003 03:24:42 +0000 |
| Subject: | Re: output buffering | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137503@lists.php.net to get a copy of this message | ||
You can't display an image like that in HTML. You need to make a second
PHP script that displays just the image, and call it with a <img> tag.
Kevin Waterson wrote:
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(){-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.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>