I am creating a simple application like comments, and you need to convert regular URLs to links, image links to images, and yt / vimeo / etc. links to flash objects. For instance:.
http://foo.bar to <a href="http://foo.bar">http://foo.bar</a> http://foo.bar/image.gif to <img src="http://foo.bar/image.gif"/> etc.
Of course, I can write all this on my own, but I think this is such an obvious piece of code that someone has already written (perhaps even with the text split into
) For some time I searched Google, but could not find anything complicated, just a few fragments. Is there a filter (or something like that)?
Thanks!
PS. There is urlize, but it only works for the first case.
source share