I have a ‘home page’ that contains a few samples of a ‘news items’ that are taken from the main ‘news’ page within the site.
I need to remove any images that the client might add as they will look ok for the main ‘news’ pages but not on the home page. Is there any way I can strip out the images just for the home page? I have looked through the web but I can’t see or think of an easy way to do this. For example the path to these images would be <img style="margin: 5px; float: left;" src="news/art_small.jpg" alt="Art Image" /> and I can’t think of how to successfully remove this string as obviously it can change depending on the setting the client uses.
I use TinyMCE as the CMS editor and the images can be added by the client and tweaked from there. Maybe there is a regExp or similar but I’m really not sure.
Any ideas as to how I can approach this?
Thanks
Strip out images
Moderator: General Moderators
Re: Strip out images
It's a bit of a hack, but you could try this:
Code: Select all
preg_replace('/<img.*?>/is', null, $str);Re: Strip out images
Thanks very much. That worked very well and I appreciate your help.
Re: Strip out images
Awesome.