I was wondering if there was a way to do this rather than make my own function, I have a tag like

PHP Code:
<img src="image.jpg"
and I need to add attributes to it, sometimes more than one, like height=x and width=x sometimes, but not others.

So a tag in that format is stored in my database column, and I need to modify them on the fly, any ideas?