Hello everyone,
as most of you probably know, we can serve images from PHP using constructs like this:
RewriteRule ^images/([a-zA-Z0-9]+)\.jpg script.php?image=$1
And then in PHP:
header('Content-Type: image/png');
$image=imagecreatefromjpeg($pathComputedSomewhereElse);
imagejpeg($image);
That's dead simple, but that's not my problem - i simply don't want to confuse you.
My question is:
How can I, if it is possible, serve such image directly, using PHP only to fetch image path? I want Apache to do the work, not PHP reading file and outputting data as binary stream. Prototype markup would be as follows [same .htaccess]:
header('Content-Type: image/png');
header('Location: '.$pathComputedSomewhereElse);