|
Posted by Rik on 03/09/07 12:24
bill <nobody@spamcop.net> wrote:
> Rik wrote:
>> bill <nobody@spamcop.net> wrote:
>>
>>> I am in the preliminary design stage.
>>> client wants to serve one of several small gifs from a database
>>> depending on user selection. I can do all of that easily except serve
>>> the images.
>>>
>>> I imagine that I will have an img tag that will invoke a php script,
>>> but how do I serve the img so that the browser displays it as an image
>>> rather than (garbage) text ?
>> Default mime type for php is usually text/html. For images, you'd have
>> to send the correct header.
>> header('Content-Type: image/gif');
>> If the mime-types differs, optionally use getimagesize to get the
>> correct mimetype of the image.
>> --Rik Wasmus
>> Posted on Usenet, not any forum you might see this in.
>> Ask Smart Questions: http://tinyurl.com/anel
>
> thanks for the suggestions.
> If I send the correct header, will that override the text/html header or
> will both be sent ?
<http://www.php.net/header>:
void header ( string $string [, bool $replace [, int $http_response_code]]
)
The optional replace parameter indicates whether the header should replace
a previous similar header, or add a second header of the same type. By
default it will replace, but if you pass in FALSE as the second argument
you can force multiple headers of the same type.
--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions: http://tinyurl.com/anel
Navigation:
[Reply to this message]
|