what is better : readfile, fpassthru, or header(" Location: ...") ?
- From: andre rodier <andrerodier@xxxxxxx>
- Date: Tue, 24 Jul 2007 12:48:01 +0100
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
- Follow-Ups:
- Prev by Date: Re: stripslashes vs quotes
- Next by Date: Re: what is better : readfile, fpassthru, or header(" Location: ...") ?
- Previous by thread: stripslashes vs quotes
- Next by thread: Re: what is better : readfile, fpassthru, or header(" Location: ...") ?
- Index(es):
Relevant Pages
|