View Single Post
  #9  
Old 14th February 2019, 18:27
Tedmorris Tedmorris is offline
Senior Member
 
Join Date: Sep 2017
Posts: 62
Default
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:
$avatar $CURUSER["avatar"];
$avatar2 "https://images.weserv.nl/?url=ssl:$avatar";
  echo(
"<img src='$avatar2' />"); 
This works but the link outputs to https://images.weserv.nl/?url=ssl:ht...com/avatar.png so I need to strip the http:// from the variable first or try make preg_replace do it or try make it work with your custom function I guess.

I tried using
PHP Code:
$avatar2 preg_replace("/\http:\/\/([^\s'\"<>]+(\.gif|\.jpg|\.png))\/""<img border=\"0\" src=\"https://images.weserv.nl/?url=ssl:\\$avatar\">"$avatar2); 
But it doesn't work, I think I removed the img tags from it incorrectly.

PHP Code:
$avatar2 preg_replace("/\[img\]http:\/\/([^\s'\"<>]+(\.gif|\.jpg|\.png))\[\/img\]/""<img border=\"0\" src=\"https://images.weserv.nl/?url=ssl:\\$avatar\">"$avatar2); 
Reply With Quote