| @@ 1930-1934 (lines=5) @@ | ||
| 1927 | { |
|
| 1928 | list ($width, $height) = url_image_size($imgtag); |
|
| 1929 | ||
| 1930 | if (!empty($modSettings['max_image_width']) && $width > $modSettings['max_image_width']) |
|
| 1931 | { |
|
| 1932 | $height = (int) (($modSettings['max_image_width'] * $height) / $width); |
|
| 1933 | $width = $modSettings['max_image_width']; |
|
| 1934 | } |
|
| 1935 | ||
| 1936 | if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height']) |
|
| 1937 | { |
|
| @@ 1936-1940 (lines=5) @@ | ||
| 1933 | $width = $modSettings['max_image_width']; |
|
| 1934 | } |
|
| 1935 | ||
| 1936 | if (!empty($modSettings['max_image_height']) && $height > $modSettings['max_image_height']) |
|
| 1937 | { |
|
| 1938 | $width = (int) (($modSettings['max_image_height'] * $width) / $height); |
|
| 1939 | $height = $modSettings['max_image_height']; |
|
| 1940 | } |
|
| 1941 | ||
| 1942 | // Set the new image tag. |
|
| 1943 | $replaces[$matches[0][$match]] = '[img width=' . $width . ' height=' . $height . $alt . ']' . $imgtag . '[/img]'; |
|
| @@ 412-416 (lines=5) @@ | ||
| 409 | } |
|
| 410 | ||
| 411 | // Now check the height, as well. Might have to scale twice, even... |
|
| 412 | if ($desired_height > $modSettings['max_image_height'] && !empty($modSettings['max_image_height'])) |
|
| 413 | { |
|
| 414 | $desired_width = (int) (($modSettings['max_image_height'] * $desired_width) / $desired_height); |
|
| 415 | $desired_height = $modSettings['max_image_height']; |
|
| 416 | } |
|
| 417 | ||
| 418 | $replaces[$matches[0][$match]] = '[img' . (!empty($desired_width) ? ' width=' . $desired_width : '') . (!empty($desired_height) ? ' height=' . $desired_height : '') . ']' . $matches[4][$match] . '[/img]'; |
|
| 419 | } |
|