Posted: Sat May 31, 2003 5:09 pm
The above works, I like to use it for counter scripts when I have to pass on vavascript data(browser, screen size, etc.) to a php script. I make javascript make a <img src="track.php?browser=***&height=***, etc."> then the php script inserts the data into a MySQL database then returns a single pixel for the image, its VERY handy.stuart wrote:You can call an image binary from anywhere in your script (even if headers have already been sent). You just do this:Galt wrote:I dont believe that works, since you've already sent text before the header() method. Plus readfile() just dumps the actual file contents, so your code will look like (if the header() command is taken out):
... <td> #$U%I#%U#IO$%U@#%BINARY_FROM_JPEG_FILE@#$J%J@#% </td> ....
I'm gonna try the .htaccess code now ... hope that works.
getimage.phpyourscript.phpCode: Select all
$file = $image."jpg"; header('content-type: image/jpeg'); echo readfile($file);I use includes to get images from a database, so the above should work (I didn't test it thoughCode: Select all
<html> <body> <table> <tr> <td> Some text </td> <td> <img src="getimage.php?image=yourfile"> </td></tr></table> </html>)