Code Duplication    Length = 5-5 lines in 3 locations

Sources/Subs-Post.php 1 location

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

Sources/Subs.php 2 locations

@@ 1836-1840 (lines=5) @@
1833
						{
1834
							list ($width, $height) = url_image_size($imgtag);
1835
1836
							if (!empty($modSettings['max_image_width']) && $width > $modSettings['max_image_width'])
1837
							{
1838
								$height = (int) (($modSettings['max_image_width'] * $height) / $width);
1839
								$width = $modSettings['max_image_width'];
1840
							}
1841
1842
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1843
							{
@@ 1842-1846 (lines=5) @@
1839
								$width = $modSettings['max_image_width'];
1840
							}
1841
1842
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1843
							{
1844
								$width = (int) (($modSettings['max_image_height'] * $width) / $height);
1845
								$height = $modSettings['max_image_height'];
1846
							}
1847
1848
							// Set the new image tag.
1849
							$replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]';