View Single Post
  #6  
Old 14th February 2019, 14:03
darkalchemy darkalchemy is offline
Administrator
 
Join Date: Dec 2017
United States
Posts: 101
Default
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\]/", "<img border=\"0\" src=\"https://images.weserv.nl/?url=ssl:\\1\">", $s);
It seems that you changed your needs from your first post.

Code:
$s = preg_replace("/\[img\]http:\/\/([^\s'\"<>]+(\.(jpg|gif|png))\[\/img\]/i", "<a href=\"\\1\" target=\"_self\"><img border=\"0\" src=\"https://images.weserv.nl?url=ssl:\\1\"></a>", $s);

Last edited by darkalchemy; 14th February 2019 at 14:13.
Reply With Quote