Before

<p>Some random sentence or whatever.</p>
<figure id='post-167550 media-167550' class='align-none'>
  <img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' alt='' />
</figure>
<p>Another random sentence or whatever.</p>
<figure id='post-167550 media-167550' class='align-none'>
  <img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' width='500' height='200' alt='' />
</figure>    

After

<p>Some random sentence or whatever.</p> 
<figure id='post-167550 media-167550' class='align-none'>
   <img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' alt='' width="320" height="" /> 
</figure> 
<p>Another random sentence or whatever.</p> 
<figure id='post-167550 media-167550' class='align-none'>
   <img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' width='320' height='' alt='' /> 
</figure>    

PHP

PHP Simple HTML DOM Parser: http://simplehtmldom.sourceforge.net/

require_once('Simple_HTML_DOM.php');
 
$post_html = "<p>Some random sentence or whatever.</p>
<figure id='post-167550 media-167550' class='align-none'>
  <img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' alt='' />
</figure>
 
<p>Another random sentence or whatever.</p>
<figure id='post-167550 media-167550' class='align-none'>
  <img src='http://css-tricks.com/wp-content/uploads/2014/04/concept.png' width='500' height='200' alt='' />
</figure>";
 
$post_html_raw = str_get_html($post_html);
 
foreach($post_html_raw->find('img') as $image) {
  $image_src = $image->src;
  $image->width = '320';
  $image->height = '';
}
 
echo $post_html_raw;
    

Gist: https://gist.github.com/jonsuh/9981407