Bravo List
Register
Go Back   > Bravo List > P2P > Forum > Community Cafe
Reply
  #1  
Old 10-02-18, 15:12
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 51
Default Image Proxy
Simple-Image-ProxyClick the image to open in full size.
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 image 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.

How To:
get the code
Code:
git clone https://github.com/darkalchemy/Simple-Image-Proxy.git image-proxy
set ownership
Code:
chown -R www-data:www-data image-proxy
install dependancies
Code:
cd image-proxy
composer install
set webroot to path image-proxy/public
edit settings.php
Code:
replace the uid and key with values given to the requsting site. These values must match.
Usage by the requsting site
add class with composer
Code:
composer require blocktrail/cryptojs-aes-php
use class in site
Code:
use Blocktrail\CryptoJSAES\CryptoJSAES;
to return image without modification
Code:
$encrypted = CryptoJSAES::encrypt($url, $key);
return 'http://image_proxy_url/image?' . base64_encode($encrypted . '&uid=' . uid);
to return image and resize the image
Code:
$encrypted = CryptoJSAES::encrypt("$url&width={$width}&height={$height}", $key);
return 'http://image_proxy_url/image?' . base64_encode($encrypted . '&uid=' . uid);
This image proxy is in use with Pu-239, if you care to see it, but can be used with any site that makes a proper request.

How to add to your site.

The code is licensed MIT and is available on github.
https://github.com/darkalchemy/Simple-Image-Proxy
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.

Last edited by darkalchemy; 11-02-18 at 10:56.
Reply With Quote
The Following User Says Thank You to darkalchemy For This Useful Post:
romano1 (10-02-18)
Reply

Tags
image , proxy

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT +2. The time now is 06:26. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2018, vBulletin Solutions Inc.