0
I am trying to turn the link of an image into the image inside the tag, however I am having difficulties when there is the image, the same I try to do with the link
in case I use the code below
$reply = preg_replace('#((http://|https://|//)([^\s]*)\.jpg|gif|png|JPG))#',
'<img src="$1" alt="" width="" height="" />', $data['reply']);
It works great when the link is posted like this
http://wallpaper.ultradownloads.com.br/276255_Papel-de-Parede-Meme-Obama-Not-Bad_1280x1024.jpg
but if the text has something like this
<img src="http://wallpaper.ultradownloads.com.br/276255_Papel-de-Parede-Meme-Obama-Not-Bad_1280x1024.jpg" >
he’ll try to turn too, as I might do?
As a curiosity, a very good site to check the regex: http://www.regexr.com/
– MarceloBoni