what is better : readfile, fpassthru, or header(" Location: ...") ?



Hello,
I need to display or propose a jpeg image on a web page.

When I need to display the image, I use this code :
header("Content-Length: $fileSize") ;
header("Content-Type: $type") ;
header("Content-disposition: inline") ;
header("Location: $imageURL");

And when I need to propose the image to save, I use this one :
header("Content-Length: $fileSize") ;
header("Content-Type: $type") ;
header("Content-disposition: attachment; filename=\"$fileName\"") ;
header("Location: $imageURL");

Everything is working fine, but now, I also need to hide the real path of the
image on the server.

So instead of the header(Location: ...), I can use readfile, and this work.
But I'm not sur that is a good solution for a website, if I need to serve
multiple jpeg files of 4~5 Mb each...

My questions are :

- Is the readfile cpu consumption is really more important than serving
directly the image url with apache ?
- Is there a limit in php with the number of readfile calls, like number of
file pointers opened by fopen() ?

What is the difference with readfile and fpassthru ?

Thanks.

Attachment: signature.asc
Description: OpenPGP digital signature



Relevant Pages

  • Re: Searching for a filename in FAT
    ... Program to SEARCH FAT FOR FILE AND DISPLAY IF PRESENT ... DisplayString MACRO dummy ... ReadFile PROC NEAR ...
    (comp.lang.asm.x86)
  • Re: Luu Tran: Please port Xnews to Linux or release the code!
    ... the JPEG image, but what *does* happen, what ... many of you do not have a free binary NNTP ... In Xnews How do I get Xnews to display ...
    (news.software.readers)
  • Displaying Pictures Problems
    ... I am ahving trouble trying to get PHP to display a Jpeg Image. ... the contect type to image/jpeg at the top of the page. ...
    (alt.php)
  • Using WME with multiple sources
    ... I need to encode from a PC camera and from a jpeg image file simultaneously. ... Using some other application to display a camera input on half of the ...
    (microsoft.public.windowsmedia)
  • To Display a JPEG Image
    ... Can I use the XWindows Libraries to display a jpeg image from ... either a file or a Character buffer? ...
    (comp.windows.x)