|
Posted by Dr. No on 01/04/07 22:58
Webtechnics - Info wrote:
> I also had this problem, I can;t remember exactly how i solved it, but i
> remember that you CAN'T set the image-source to a .php file.
>
> If i now more, i'l let you know.
>
>
>
Yea, that simply isn't correct. I use .php files to send images with no problem.
The PHP script simply needs to generate the correct header before it writes any
data. For a JPEG, you'd include a line like this in your script:
header ('Content-Type: image/jpeg');
If your script is called foo.php, you can load the image like this:
<img src="foo.php" alt="A dynamic image." />
The browser will use the header rather than the extension to determine the file
type. PHP can pass any type of data to the browser using this method. One
application I wrote passes Word, Excel, PDF, HTML, JPEG, GIF, and PNG files
through the same wrapper script, and could pass anything that has a mime type by
placing the correct mime type into the database. PHP can output just about
anything to a web browser.
Navigation:
[Reply to this message]
|