Code Duplication    Length = 5-5 lines in 3 locations

Sources/Subs-Post.php 1 location

@@ 378-382 (lines=5) @@
375
			}
376
377
			// Now check the height, as well.  Might have to scale twice, even...
378
			if ($desired_height > $modSettings['max_image_height'] && !empty($modSettings['max_image_height']))
379
			{
380
				$desired_width = (int) (($modSettings['max_image_height'] * $desired_width) / $desired_height);
381
				$desired_height = $modSettings['max_image_height'];
382
			}
383
384
			$replaces[$matches[0][$match]] = '[img' . (!empty($desired_width) ? ' width=' . $desired_width : '') . (!empty($desired_height) ? ' height=' . $desired_height : '') . ']' . $matches[4][$match] . '[/img]';
385
		}

Sources/Subs.php 2 locations

@@ 1778-1782 (lines=5) @@
1775
						{
1776
							list ($width, $height) = url_image_size($imgtag);
1777
1778
							if (!empty($modSettings['max_image_width']) && $width > $modSettings['max_image_width'])
1779
							{
1780
								$height = (int) (($modSettings['max_image_width'] * $height) / $width);
1781
								$width = $modSettings['max_image_width'];
1782
							}
1783
1784
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1785
							{
@@ 1784-1788 (lines=5) @@
1781
								$width = $modSettings['max_image_width'];
1782
							}
1783
1784
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1785
							{
1786
								$width = (int) (($modSettings['max_image_height'] * $width) / $height);
1787
								$height = $modSettings['max_image_height'];
1788
							}
1789
1790
							// Set the new image tag.
1791
							$replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]';