markvaughn2006 Posted February 4, 2010 Share Posted February 4, 2010 Please help me, I can't figure this out.. If a user's input is- "Hello my name is Mark and I want to make http://news-libraries.mit.edu/blog/wp-content/uploads/2008/01/money.jpg" How would i make it output "Hello my name is Mark and I want to make (display the picture)" I can find the image link with- https?://[\w./]+\/[\w./]+\.(bmp|png|jpg|gif) just not sure how to tie it all together, any help would be greatly appreciated even if it's just point my me in the right direction! Thanks guys Link to comment https://forums.phpfreaks.com/topic/190947-display-an-image-in-middle-of-a-users-message/ Share on other sites More sharing options...
JAY6390 Posted February 4, 2010 Share Posted February 4, 2010 use preg_replace, capture the whole regex by putting braces around it, then use '<img src="$1" />' as the replace string Link to comment https://forums.phpfreaks.com/topic/190947-display-an-image-in-middle-of-a-users-message/#findComment-1006910 Share on other sites More sharing options...
markvaughn2006 Posted February 4, 2010 Author Share Posted February 4, 2010 wow that was easy! thanks man Link to comment https://forums.phpfreaks.com/topic/190947-display-an-image-in-middle-of-a-users-message/#findComment-1006923 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.