The purpose of this image proxy is to reduce the exposure of the requesting sites url, when hot-linking images, by using the image proxy to make the http request, store the image and return the image from the proxy in an http response.
This could also be used to serve images that are using http links on your https site. Thereby not opening up a security hole.
This image proxy will store an optimized for web version of the original image and can return that image in any dimensions that are included with the http request.
git clone https://github.com/darkalchemy/Simple-Image-Proxy.git image-proxy
chown -R www-data:www-data image-proxy
cd image-proxy
composer install
replace the uid and key with values given to the requsting site. These values must match.
composer require blocktrail/cryptojs-aes-php
use Blocktrail\CryptoJSAES\CryptoJSAES;
$encrypted = CryptoJSAES::encrypt($url, $key);
return 'http://image_proxy_url/image?' . base64_encode($encrypted . '&uid=' . uid);
$encrypted = CryptoJSAES::encrypt("$url&width={$width}&height={$height}", $key);
return 'http://image_proxy_url/image?' . base64_encode($encrypted . '&uid=' . uid);