PHP, display image with Header()

Posted by user271619 on Stack Overflow See other posts from Stack Overflow or by user271619
Published on 2010-04-13T23:29:56Z Indexed on 2010/04/13 23:32 UTC
Read the original article Hit count: 344

Filed under:
|

I'm displaying images from outside my web root, like this:

header('Content-type:image/png'); readfile($fullpath);

The content-type: image/png is what confuses me.

Someone else helped me out with this code, but I noticed that not all images are PNG. Many are jpg or gif.
And still they are displayed successfully.

does anyone know why?

© Stack Overflow or respective owner

Related posts about headers

Related posts about php