External image proxy modifications
I'm trying to use an external image proxy server to load http images over https. For example, a user uses the image tag on the forums of http://images2.imagebam.com/2f/9d/32...1038500004.png
By adding https://images.weserv.nl/?url=ssl: to the start of the url and stripping the http:// the embeded link becomes https://images.weserv.nl/?url=ssl:im...1038500004.png but I'm struggling to get it working in globalstar.. This.. PHP Code:
PHP Code:
Any help would be great and much appreciated.[/QUOTE] |
I think you are missing a back slash.
Code:
url=ssl:\1 Code:
url=ssl:\\1 |
Thanks champ.
Now outputting https://images.weserv.nl/?url=ssl:http://i68.tinypic.com/2qcm3x5.jpg" width="150" height="150" alt=""> Any idea how to strip the http:// from the image inserted via the [img] tag ? |
Change:
Code:
(http:\/\/ Code:
http:\/\/( |
Sweet. Now outputting
https://images.weserv.nl/?url=ssl:images2.imagebam.com/2f/9d/32/b55ec21038500004.png"> From.. PHP Code:
|
This is a bit difficult to do on my phone. But this should work.
Code:
$s = preg_replace("/\[img\]http:\/\/([^\s'\"<>]+(\.gif|\.jpg|\.png))\[\/img\]/", "", $s); |
Legend :ok:
PHP Code:
Again many thanks m8. It's very appreciated. What does the "i" do that was removed from \[\/img\]/i", I know why it changed from first post, I used an older version in my last post that I had commented out and didnt realise until you pointed it out sry, I'm guessing if it's got the \.gif|\.jpg|\.png etc and not just gif| jpg|png then the "i" is required I'm thinking for the http avatars in forums, change this.. PHP Code:
PHP Code:
|
Avatars are a bit more work, since they are requested all over.
They way that I handled it was to create a function that would replace the url with the proxied one. Then everywhere avatars are requested use the function. This also makes caching much easier. |
Yeah it does seem a bit tricky, I've been playing around with it for the best part of 2 hours lol..is your function in the Pu-239 source?
I couldnt get the preg_replace to work, I'm still learning the metacharacters and how to use them properly. Havent played with the preg_replace function before. I tested that it outputs with a variable added without preg_replace.. PHP Code:
I tried using PHP Code:
PHP Code:
|
Just strip it out like
Code:
str_replace(['http://', 'https://'], $avatar) Code:
function url_proxy($url, $image = false, $width = null, $height = null, $quality = null) |
All times are GMT +2. The time now is 22:43. |
Powered by vBulletin® Version 3.8.11 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions Inc.