<p>This will serve as a debug page.</p>
<p><img src="http://mattmueller.me/blog/wp-content/uploads/2009/12/threadless.png" alt="Threadless" title="Threadless" width="650" height="150" class="alignnone size-full wp-image-73" /></p>

<p>This will serve as a debug page.</p>
<img src="http://mattmueller.me/blog/wp-content/uploads/2009/12/threadless.png" alt="Threadless" title="Threadless" width="650" height="150" class="alignnone size-full wp-image-73" />

You'll find that there's no <p> tags all around the image tag. I'd like this simply to remove <p> tags that wrap images. Wordpress is annoying.. basically. If it is simpler having a str_replace or something like that, tell me. But I have attempted. And unsuccessful to date....

Thanks! Matt Mueller

Here is a useful gizmo that may help you, hopefully:

http://www.gskinner.com/RegExr/

s/<p>(<img.*?\/>)<\/p>/$1/g
$x = preg_replace('/<p[^>]*>(<img[^>]*>)<\/p[^>]*>/', '$1', $x);

Where $x is the content