vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Image Proxy (https://vborg.vbsupport.ru/showthread.php?t=315359)

kh99 12-17-2014 10:28 AM

Sorry AndrewSimm, I never did get to this. Are you still looking for something like this?

Zachery 12-17-2014 04:58 PM

It would be fairly trivial to setup your own server like nginx with spdy to serve content instead of trying to go though a proxy.

kh99 12-17-2014 05:03 PM

My understanding is that the OP wants to proxy other external content, so that it is all available via https. He said in a previous post that he doesn't want to save everything on his server. It seems to me that you'd at least need to rewrite the urls in IMG tags to make that work.

Zachery 12-17-2014 06:52 PM

Ideally, you'd still want that proxy caching as much as it could, so it cuts down on its bandwidth.

kh99 12-17-2014 07:12 PM

Yeah, I'm far from an expert on that stuff, but I know there are caching proxy servers that exist, and it would probably be better to have a mod to rewrite the urls and point them to one of those than to hack together a proxy myself. But then, not everyone has the ability or desire to set that stuff up, and a script might be good enough for some sites (but it's certainly worth mentioning that using an existing server might be a better way to go - I'll wait to see what AndrewSimm has to say).

AndrewSimm 12-18-2014 05:57 AM

caching would be a plus. I am not sure how external images in bb code are cached now. Here is what I have created so far

proxy.php
PHP Code:

<?php 

$image 
filter_var($_GET['url'], FILTER_SANITIZE_URL); 

header('Content-Type: image/png'); 

if(isset(
$image)) { 
    echo 
file_get_contents($image);} 

?>

bbcode_image_match hook
PHP Code:

$retval = ($fullsize '<div class="size_fullsize">' '')  . '<img src="proxy.php?url=' rawurlencode($link) . '" border="0" alt="" />' . ($fullsize '</div>' ''); 

The above accomplishes having the image go through https as I have moved my DNS to cloudflare and have no mixed content warnings. I am not sure how the above would be cached and I am not sure how to prevent someone from using my proxy.php file as their own image proxy. Basically I only want vbulletin to be able to use this php file. I have tested it and I think it is safe from file inclusion but I could be wrong.

--------------- Added [DATE]1418889666[/DATE] at [TIME]1418889666[/TIME] ---------------

Here is an example
https://www.canesinsight.com/proxy.p...om/UxY5hpY.png

One thing I would like to fix is when someone goes back to edit the image in the img tags it shows the full link with the proxy.php. This could confuse some users so not sure how I can just have it use that in front of the image when the page is rendered but hidden when someone clicks to view the code to edit the img tag.

kh99 12-18-2014 10:38 AM

Oh, OK, so you mostly solved the problem yourself already?

AndrewSimm 12-18-2014 04:11 PM

Quote:

Originally Posted by kh99 (Post 2527896)
Oh, OK, so you mostly solved the problem yourself already?

I have the proxy working so I guess so. I just have a few things to work out that I can't figure out.

kh99 12-18-2014 05:45 PM

Quote:

Originally Posted by AndrewSimm (Post 2527944)
I have the proxy working so I guess so. I just have a few things to work out that I can't figure out.

OK, then I may still try it if I get motivated. Implementing a proxy with caching seems interesting.

ETA: Also, that's pretty clever that you got it basically working with only a few lines of code. I was thinking about how to do it and obviously I was making things too complicated.

Dave 12-18-2014 07:37 PM

Quote:

Originally Posted by kh99 (Post 2527951)
OK, then I may still try it if I get motivated. Implementing a proxy with caching seems interesting.

ETA: Also, that's pretty clever that you got it basically working with only a few lines of code. I was thinking about how to do it and obviously I was making things too complicated.

Might be clever, but I could cause a huge load on the server if I include big images. Easy to do a DoS attack like that.


All times are GMT. The time now is 12:28 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03112 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete