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: 58
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)
  #2  
Old 17-12-18, 03:27
Tedmorris's Avatar
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 24
Default
Whats Pu-239? Ive searched the forums and cant find it i wanted to see the image proxy in action.
Reply With Quote
  #3  
Old 17-12-18, 04:02
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 58
Default
Quote:
Originally Posted by Tedmorris View Post
Whats Pu-239? Ive searched the forums and cant find it i wanted to see the image proxy in action.
Really, you searched for it?

https://www.bvlist.com/forumdisplay.php?f=128
https://pu-239.pw
https://github.com/darkalchemy/Pu-239


But, I removed the code for Image Proxy from GitHub because I could not make the images cache in the browser. So, I rolled the code into Pu-239. Now, the Image Proxy simply fetches the external image, manipulates it as desired, stores it and then displays it as an internal image.

And.... every externally linked image displayed in my code is run through the Image Proxy, which can be disabled if desired.
__________________
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; 17-12-18 at 04:44.
Reply With Quote
  #4  
Old 17-12-18, 06:31
Tedmorris's Avatar
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 24
Default
Thx m8, maybe i used the wrong search word. I tried Pu-239 with no results.
Reply With Quote
  #5  
Old 17-12-18, 06:39
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 58
Default
No worries, just giving you a hard time.
__________________
I do custom coding, source installs, mods, server setup and/or config, etc. Feel free to pitch me your needs and your offer.
Reply With Quote
  #6  
Old 17-12-18, 11:29
Tedmorris's Avatar
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 24
Default
All good m8, that many ppl post without looking that it kinda goes unsaid and if you found it by doing a search then im doing something wrong and should be pulled up on it lol

Ive checked out the source and see where it refrences the images to the proxy but im confused about the whole setup and im undecided about what to do.
Reply With Quote
  #7  
Old 17-12-18, 14:49
darkalchemy's Avatar
darkalchemy darkalchemy is offline
VIP
 
Join Date: Dec 2017
United States
Posts: 58
Default
Sorry, but you can't just pull it out of my code to use it in another. But, you can look at the function url_proxy() and the ImageProxy class.

Those 2 are responsible for handling the 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.
Reply With Quote
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 16:14. vBulletin skin by ForumMonkeys. Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2018, vBulletin Solutions Inc.