Categories > TinyButStrong general >

Image display

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: shadow
Date: 2004-02-26
Time: 18:31

Image display

I have images into a dir web/files
my html and php is into dir web/html

now i will display images in my site without display the path of my images. normaly i can use view.php?id=xx

when i merge this too my templet then i have a error "Cannot modify header information - headers already sent by (output started....."

view.php------
header("Content-Type: image/jpeg");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, max-age=0, must-revalidate");
readfile("20051/20051-001.jpg");

my tpl file
<img src="view.php">
By: RwD
Date: 2004-02-26
Time: 22:17

Re: Image display

well, the headers are sent, as soon as even a single bit of output was sent to the file the client gets.

So you must make sure there is not a single (empty) line or whatever outputted or anything echoed or whatever!!

for php:
<?
// set a cookie here for example
?>
that code will give you a problem allready because the first line in the code segment is output!! (so everything before <?)

that might help?
By: shadow
Date: 2004-02-26
Time: 22:54

Re: Image display

one space on the first line ...


thx for help
By: RwD
Date: 2004-02-27
Time: 22:07

Re: Image display

yes, even though my example got messed up because as it seems the first line got taken out :S