View Single Post
  #7  
Old 14th February 2019, 14:37
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
Legend

PHP Code:
$s preg_replace("/\[img\]http:\/\/([^\s'\"<>]+(\.gif|\.jpg|\.png))\[\/img\]/""<img border=\"0\" src=\"https://images.weserv.nl/?url=ssl:\\1\">"$s); 
Works like a charm. Thank you so much. Now I just need to figure out how to apply it to rendered avatar images pulled from a users table row. Eventually I'd like to do as you have with the image proxy on the same server as the tracker in order to prevent being defendant on a 3rd party image proxy but one thing at a time I guess lol

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:
if ($CURUSER["avatars"] == "yes")
 
$avatar htmlspecialchars($row["avatar"]);
        
print(
"<td align=center width=150 style='padding: 0px'><img width=150 src=$avatar></td>\n"); 
To this..

PHP Code:
if ($CURUSER["avatars"] == "yes")
 
$avatar preg_replace("/\http:\/\/([^\s'\"<>]+(\.gif|\.jpg|\.png))\/""<img border=\"0\" src=\"https://images.weserv.nl/?url=ssl:\\$users[avatar]\">"$avatar);
        
print(
"<td align=center width=150 style='padding: 0px'><img width=150 src=$avatar></td>\n"); 

Last edited by Tedmorris; 14th February 2019 at 15:15.
Reply With Quote