strip_tags($text, '<img>') //strips all tags other than the image tag
However, I need it to do the reverse i.e accept all tags, but strip any image tags from $text. If it existed the function might work something like this:
allow_tags($text, '<img>') //allows all tags, but strips image tags
Does such a function or something like it exist as I can’t find it. I’m at the planning stages of a mobile version of my site and thought that if I could strip images from my page content it would help things load faster for the user.
There isn’t as far as I know, you would have to write your own function to do that. Here is some weird function I found in my archive, maybe it can be of some use?
HTMLPurifier filters HTML, id doesn’t remove tags unless they are not valid in the doctype. Img tags inside a text is valid makrup so HTMLPurifier would not help him.