PHP : Fastest way to load images through a proxy
I'm loading some image from a source that is not SSL. In order for this not to break my SSL certificate I have having to load them through this simple P开发者_StackOverflow中文版HP proxy page:
<?php
header('Content-Type: image/png');
if(isset($_GET['url'])){echo file_get_contents($_GET['url']);}
?>
This works but unfortunately I'm experiencing quite slow load times. Does anyone know a faster way to proxy images?
Thanks Guys!
You could look at X-Sendfile, it would work a bit like this:
$file = '/path/to/images/' . $_GET['url'];
header('X-Sendfile: ' . $file);
but Apache would be handling the process itself rather than the overhead of PHP.
http://codeutopia.net/blog/2009/03/06/sending-files-better-apache-mod_xsendfile-and-php/
http://www.jasny.net/articles/how-i-php-x-sendfile/
精彩评论