Code Duplication    Length = 5-5 lines in 3 locations

Sources/Subs-Post.php 1 location

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

Sources/Subs.php 2 locations

@@ 1822-1826 (lines=5) @@
1819
						{
1820
							list ($width, $height) = url_image_size($imgtag);
1821
1822
							if (!empty($modSettings['max_image_width']) && $width > $modSettings['max_image_width'])
1823
							{
1824
								$height = (int) (($modSettings['max_image_width'] * $height) / $width);
1825
								$width = $modSettings['max_image_width'];
1826
							}
1827
1828
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1829
							{
@@ 1828-1832 (lines=5) @@
1825
								$width = $modSettings['max_image_width'];
1826
							}
1827
1828
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1829
							{
1830
								$width = (int) (($modSettings['max_image_height'] * $width) / $height);
1831
								$height = $modSettings['max_image_height'];
1832
							}
1833
1834
							// Set the new image tag.
1835
							$replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]';