Use Reg Expression to reformat image in RSS feed

dburr

New Member
I am creating some RSS feeds using PHP (5.2) from a MySQL db specifically for an iPhone app I am making through AppMakr.They are taken from articles on a website which contain images embedded in them, however in the feeds they don't look great. What I want to try and do is whenever there is an image surround it in \[code\]<p>\[/code\] so they are on their own line and don't try to wrap around article text.The format of a image is like this:\[code\] <a rel="lightbox" href="http://images.domain.comk/543/image1.jpg"><img class="imageright" src="http://images.domain.comk/543/image1.jpg" alt="" width="300" height="250" /></a>\[/code\]So basically surrounded with a \[code\]<a href>\[/code\] and with a class of "imageright" or "imageleft".What I would love to change this to is:\[code\] <p><img src="http://images.domain.comk/543/image1.jpg" alt="" width="300" height="250" /></p>\[/code\]Basically removing the href and imagexxxx class and surrounding in p tags.I am thinking preg_replace will prob have to be used, but at a loss to what I would actually use for it. Any help is very appreciated.
 
Back
Top