diff --git a/sites/all/modules/img_assist/img_assist.module b/sites/all/modules/img_assist/img_assist.module index 3aa560e..7f02aec 100644 --- a/sites/all/modules/img_assist/img_assist.module +++ b/sites/all/modules/img_assist/img_assist.module @@ -1261,7 +1261,7 @@ function img_assist_render_image($attributes = array()) { // Get size. $width = $attributes['width']; $height = $attributes['height']; - if ($width && $height) { + if ($width || $height) { // Check to ensure that the dimensions don't exceed the max set in the // img_assist settings. $max_size = explode('x', variable_get('img_assist_max_size', '640x640')); @@ -1286,11 +1286,13 @@ function img_assist_render_image($attributes = array()) { $aspect_ratio = round($preview_width / $preview_height, 6); // Get new width and height for this inline image. - // Width is controlling factor. - if (round($width / $aspect_ratio) <= $height) { + // If height is either left out or larger than width then + // width is the controlling factor. + if (!$height || round($width / $aspect_ratio) <= $height) { $height = round($width / $aspect_ratio); } - // Height is controlling factor. + // Else, width is either left out or larger than height so + // height is controlling factor. else { $width = round($height * $aspect_ratio); }