Re: Inline Images ?

From: Date: Mon, 22 Jul 2002 22:55:47 +0000
Subject: Re: Inline Images ?
Groups: php.general 
Request: Send a blank email to php-general+get-108970@lists.php.net to get a copy of this message
>Is there a way to display an image withouth sending the headers first? Not reliably. *SOME* broken browsers will use the apparent "filename" in the URL to decide what kind of document you are sending, even if you *DO* send the headers! Grrr. So you really want your URL to "end" (before any ?) in .jpg or .gif or .png or whatever. >I'm trying to display an inline image... but when I try it just only >send the raw image data... Don't. You cannot (as far as I know) cram an image "inline" into an HTML document. >I've thinking that I need to save an image first to disk and then >display the image later... You do not need to do that either, though. >I don't want to do this... but I wanna hear another possiblities before >doing that... You need two (2) files. One with an IMG tag in it, that points to the second file. The second file needs to spew out a valid JPEG (or GIF or PNG) Sample: ----------------- index.html ------------------------------------------------------ <HTML><BODY><IMG SRC=image.php/stupidbrowser.jpg?filename=pretty.jpg></BODY></HTML> ---------------------------------------------------------------------------- ------- ----------------- pretty.jpg ------------------------------------------------------ <?php header("Content-type: image/jpeg"); header("Content-length: " . filesize("/full/path/to/$filename")); readfile("/full/path/to/$filename"); ?> ---------------------------------------------------------------------------- ------- -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#108970) next »