Skip to content

Commit

Permalink
Merge pull request SimpleMachines#6733 from BrickOzp/max_image_width_…
Browse files Browse the repository at this point in the history
…height

Use max image width and height settings everywhere
  • Loading branch information
MissAllSunday authored May 13, 2021
2 parents 250d45a + 9d7d09c commit dcc8e3f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/Subs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3730,11 +3730,11 @@ function setupThemeContext($forceload = false)
// Add max image limits
if (!empty($modSettings['max_image_width']))
addInlineCss('
.postarea .bbc_img { max-width: min(100%,' . $modSettings['max_image_width'] . 'px); }');
.postarea .bbc_img, .list_posts .bbc_img, .post .inner .bbc_img, form#reported_posts .bbc_img, #preview_body .bbc_img { max-width: ' . $modSettings['max_image_width'] . 'px; }');

if (!empty($modSettings['max_image_height']))
addInlineCss('
.postarea .bbc_img { max-height: ' . $modSettings['max_image_height'] . 'px; }');
.postarea .bbc_img, .list_posts .bbc_img, .post .inner .bbc_img, form#reported_posts .bbc_img, #preview_body .bbc_img { max-height: ' . $modSettings['max_image_height'] . 'px; }');

// This looks weird, but it's because BoardIndex.php references the variable.
$context['common_stats']['latest_member'] = array(
Expand Down
18 changes: 16 additions & 2 deletions Themes/default/Printpage.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
function template_print_above()
{
global $context, $txt;
global $context, $txt, $modSettings;

echo '<!DOCTYPE html>
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
Expand Down Expand Up @@ -117,7 +117,21 @@ function template_print_above()
.print_options {
margin: 1em 0;
}
}
}';

if (!empty($modSettings['max_image_width']))
echo '
.bbc_img {
max-width: ' . $modSettings['max_image_width'] . 'px;
}';

if (!empty($modSettings['max_image_height']))
echo '
.bbc_img {
max-height: ' . $modSettings['max_image_height'] . 'px;
}';

echo '
</style>
</head>
<body>';
Expand Down

0 comments on commit dcc8e3f

Please sign in to comment.