Code Duplication    Length = 5-5 lines in 3 locations

Sources/Subs-Post.php 1 location

@@ 411-415 (lines=5) @@
408
			}
409
410
			// Now check the height, as well.  Might have to scale twice, even...
411
			if ($desired_height > $modSettings['max_image_height'] && !empty($modSettings['max_image_height']))
412
			{
413
				$desired_width = (int) (($modSettings['max_image_height'] * $desired_width) / $desired_height);
414
				$desired_height = $modSettings['max_image_height'];
415
			}
416
417
			$replaces[$matches[0][$match]] = '[img' . (!empty($desired_width) ? ' width=' . $desired_width : '') . (!empty($desired_height) ? ' height=' . $desired_height : '') . ']' . $matches[4][$match] . '[/img]';
418
		}

Sources/Subs.php 2 locations

@@ 1924-1928 (lines=5) @@
1921
						{
1922
							list ($width, $height) = url_image_size($imgtag);
1923
1924
							if (!empty($modSettings['max_image_width']) && $width > $modSettings['max_image_width'])
1925
							{
1926
								$height = (int) (($modSettings['max_image_width'] * $height) / $width);
1927
								$width = $modSettings['max_image_width'];
1928
							}
1929
1930
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1931
							{
@@ 1930-1934 (lines=5) @@
1927
								$width = $modSettings['max_image_width'];
1928
							}
1929
1930
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1931
							{
1932
								$width = (int) (($modSettings['max_image_height'] * $width) / $height);
1933
								$height = $modSettings['max_image_height'];
1934
							}
1935
1936
							// Set the new image tag.
1937
							$replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]';