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

@@ 1810-1814 (lines=5) @@
1807
						{
1808
							list ($width, $height) = url_image_size($imgtag);
1809
1810
							if (!empty($modSettings['max_image_width']) && $width > $modSettings['max_image_width'])
1811
							{
1812
								$height = (int) (($modSettings['max_image_width'] * $height) / $width);
1813
								$width = $modSettings['max_image_width'];
1814
							}
1815
1816
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1817
							{
@@ 1816-1820 (lines=5) @@
1813
								$width = $modSettings['max_image_width'];
1814
							}
1815
1816
							if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height'])
1817
							{
1818
								$width = (int) (($modSettings['max_image_height'] * $width) / $height);
1819
								$height = $modSettings['max_image_height'];
1820
							}
1821
1822
							// Set the new image tag.
1823
							$replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]';