diff --git a/phpBB/adm/style/acp_icons.html b/phpBB/adm/style/acp_icons.html index 45fe7f8ebc..25d5cb5207 100644 --- a/phpBB/adm/style/acp_icons.html +++ b/phpBB/adm/style/acp_icons.html @@ -105,7 +105,7 @@ - {items.TEXT_ALT} + {items.TEXT_ALT} [{items.IMG}] diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html index d373657114..aac5de6fe7 100644 --- a/phpBB/adm/style/acp_ranks.html +++ b/phpBB/adm/style/acp_ranks.html @@ -85,7 +85,7 @@ - {ranks.RANK_TITLE}  -   + {ranks.RANK_TITLE}  -   {ranks.RANK_TITLE}   -  {ranks.MIN_POSTS} diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 6429424983..4758e89a93 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -91,29 +91,43 @@ class acp_icons { $img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img); - if (!$img_size[0] || !$img_size[1] || strlen($img) > 255) + if ($img_size) { - continue; - } + if (!$img_size[0] || !$img_size[1] || strlen($img) > 255) + { + continue; + } - // adjust the width and height to be lower than 128px while perserving the aspect ratio (for icons) - if ($mode == 'icons') + // adjust the width and height to be lower than 128px while perserving the aspect ratio (for icons) + if ($mode == 'icons') + { + if ($img_size[0] > 127 && $img_size[0] > $img_size[1]) + { + $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0])); + $img_size[0] = 127; + } + else if ($img_size[1] > 127) + { + $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1])); + $img_size[1] = 127; + } + } + } + else { - if ($img_size[0] > 127 && $img_size[0] > $img_size[1]) - { - $img_size[1] = (int) ($img_size[1] * (127 / $img_size[0])); - $img_size[0] = 127; - } - else if ($img_size[1] > 127) - { - $img_size[0] = (int) ($img_size[0] * (127 / $img_size[1])); - $img_size[1] = 127; - } + // getimagesize can't read the dimensions of the SVG files + // https://bugs.php.net/bug.php?id=71517 + $xml_get = simplexml_load_file($phpbb_root_path . $img_path . '/' . $path . $img); + + $svg_width = intval($xml_get['width']); + $svg_height = intval($xml_get['height']); } $_images[$path . $img]['file'] = $path . $img; - $_images[$path . $img]['width'] = $img_size[0]; - $_images[$path . $img]['height'] = $img_size[1]; + + // Give SVG a fallback on failure + $_images[$path . $img]['width'] = $img_size ? $img_size[0] : ($svg_width ?: 32); + $_images[$path . $img]['height'] = $img_size ? $img_size[1] : ($svg_height ?: 32); } } unset($imglist); diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 47e4e85aa1..c904e0cdf5 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -55,8 +55,8 @@ class acp_ranks $min_posts = ($special_rank) ? 0 : max(0, $request->variable('min_posts', 0)); $rank_image = $request->variable('rank_image', ''); - // The rank image has to be a jpg, gif or png - if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $rank_image)) + // The rank image has to be a jp(e)g, gif, png, svg or webp + if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg|\.svg|\.webp)$#i', $rank_image)) { $rank_image = ''; } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5f7089161b..fa4dac7e57 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -479,7 +479,7 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm /** * Get physical file listing */ -function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png') +function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png|svg|webp') { $matches = array($dir => array()); diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index d945a14bd6..fa8f952cab 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -795,6 +795,10 @@ fieldset.polls dd div { margin-bottom: 10px; } +.profile-rank img { + max-width: 160px; +} + /* Post-profile avatars */ .postprofile .has-avatar .avatar-container { overflow: hidden;