title: How to catch images with blank dimensions?
body: <p>I've created a <a href="https://wordpress.org/plugins/specify-image-dimensions/" rel="nofollow noreferrer">WordPress plugin</a> that inserts <code>width</code> and <code>height</code> attributes to all images, for example:</p>
  
  <pre><code>&lt;img src="https://placehold.it/100x50"&gt;
  - to -
  &lt;img src="https://placehold.it/100x50" width="100" height="50"&gt;
  </code></pre>
  
  <p>Yet, when there are images that have blank dimensions (for both <code>width</code> and <code>height</code>), my code doesn't doesn't catch it, for example:</p>
  
  <pre><code>&lt;img src="https://placehold.it/100x50" width="" height=""&gt;
  </code></pre>
  
  <p>However, when there is only one blank dimension, my plugin does catch it. The following two examples will work:</p>
  
  <pre><code>&lt;img src="https://placehold.it/100x50" width=""&gt;
  &lt;img src="https://placehold.it/100x50" height=""&gt;
  </code></pre>
  
  <p><a href="https://github.com/factmaven/specify-image-dimensions/blob/master/specify-image-dimensions.php" rel="nofollow noreferrer">Here's the source code</a>. On line 43 (<a href="https://github.com/factmaven/specify-image-dimensions/blob/master/specify-image-dimensions.php#L43" rel="nofollow noreferrer">#</a>), this is the logic I'm using to determine if an image is missing a <code>width</code>/<code>height</code>:</p>
  
  <pre><code>if ( ! in_array( 'width', $img[1] ) || ! in_array( 'height', $img[1] ) ) {
  </code></pre>
  
  <p>I've tried the following updated logic, but it doesn't work:</p>
  
  <pre><code>if ( # Images with no width/height
      ! in_array( 'width', $img[1] ) || ! in_array( 'height', $img[1] ) ||
      # Images with blank width/height
      ( in_array( 'width', $img[1] ) &amp;&amp; in_array( '""', $img[1] ) ) || ( in_array( 'height', $img[1] ) &amp;&amp; in_array( '""', $img[1] ) )
  ) {
  </code></pre>
  
  <p>Am I in the right area? What am I doing wrong in my logic?</p>