You are here: Re: serving an image « PHP Programming Language « IT news, forums, messages
Re: serving an image

Posted by bill on 03/09/07 12:05

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 ?

bill

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация