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

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