diff --git a/image_resize_filter.module b/image_resize_filter.module
index 7efd6f302..0db595fa5 100644
--- a/image_resize_filter.module
+++ b/image_resize_filter.module
@@ -389,8 +389,10 @@ function image_resize_filter_get_images($settings, $text) {
     $actual_height = (int) $image_size[1];
 
     // If either height or width is missing, calculate the other.
-    if (empty($attributes['width']) && empty($attributes['height'])) {
+    if (empty($attributes['width'])) {
       $attributes['width'] = $actual_width;
+    }
+    if (empty($attributes['height'])) {
       $attributes['height'] = $actual_height;
     }
     if (empty($attributes['height']) && is_numeric($attributes['width'])) {
