mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge pull request #6318 from 3D-I/ticket/16899
[ticket/16899] Add SVG and WEBP to ranks, smilies and topic icons
This commit is contained in:
commit
1df74005a8
6 changed files with 40 additions and 22 deletions
|
@ -105,7 +105,7 @@
|
||||||
<!-- BEGIN items -->
|
<!-- BEGIN items -->
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<td style="text-align: center;"><img src="{items.IMG_SRC}" alt="{items.TEXT_ALT}" title="{items.TEXT_ALT}" /><input type="hidden" name="image[{items.IMG}]" value="1" /></td>
|
<td style="text-align: center;"><img src="{items.IMG_SRC}" alt="{items.TEXT_ALT}" title="{items.TEXT_ALT}" style="max-width: 160px;"><input type="hidden" name="image[{items.IMG}]" value="1" /></td>
|
||||||
<td style="vertical-align: top;">[{items.IMG}]</td>
|
<td style="vertical-align: top;">[{items.IMG}]</td>
|
||||||
<!-- IF S_SMILIES -->
|
<!-- IF S_SMILIES -->
|
||||||
<td><input class="text post" type="text" name="code[{items.IMG}]" value="{items.CODE}" size="10" maxlength="50" /></td>
|
<td><input class="text post" type="text" name="code[{items.IMG}]" value="{items.CODE}" size="10" maxlength="50" /></td>
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
<!-- BEGIN ranks -->
|
<!-- BEGIN ranks -->
|
||||||
<tr>
|
<tr>
|
||||||
<!-- EVENT acp_ranks_list_column_before -->
|
<!-- EVENT acp_ranks_list_column_before -->
|
||||||
<td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" /><!-- ELSE --> - <!-- ENDIF --></td>
|
<td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" style="max-width: 160px;"><!-- ELSE --> - <!-- ENDIF --></td>
|
||||||
<td style="text-align: center;">{ranks.RANK_TITLE}</td>
|
<td style="text-align: center;">{ranks.RANK_TITLE}</td>
|
||||||
<td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td>
|
<td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK --> - <!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td>
|
||||||
<!-- EVENT acp_ranks_list_column_after -->
|
<!-- EVENT acp_ranks_list_column_after -->
|
||||||
|
|
|
@ -91,29 +91,43 @@ class acp_icons
|
||||||
{
|
{
|
||||||
$img_size = getimagesize($phpbb_root_path . $img_path . '/' . $path . $img);
|
$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)
|
// adjust the width and height to be lower than 128px while perserving the aspect ratio (for icons)
|
||||||
if ($mode == '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])
|
// getimagesize can't read the dimensions of the SVG files
|
||||||
{
|
// https://bugs.php.net/bug.php?id=71517
|
||||||
$img_size[1] = (int) ($img_size[1] * (127 / $img_size[0]));
|
$xml_get = simplexml_load_file($phpbb_root_path . $img_path . '/' . $path . $img);
|
||||||
$img_size[0] = 127;
|
|
||||||
}
|
$svg_width = intval($xml_get['width']);
|
||||||
else if ($img_size[1] > 127)
|
$svg_height = intval($xml_get['height']);
|
||||||
{
|
|
||||||
$img_size[0] = (int) ($img_size[0] * (127 / $img_size[1]));
|
|
||||||
$img_size[1] = 127;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$_images[$path . $img]['file'] = $path . $img;
|
$_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);
|
unset($imglist);
|
||||||
|
|
|
@ -55,8 +55,8 @@ class acp_ranks
|
||||||
$min_posts = ($special_rank) ? 0 : max(0, $request->variable('min_posts', 0));
|
$min_posts = ($special_rank) ? 0 : max(0, $request->variable('min_posts', 0));
|
||||||
$rank_image = $request->variable('rank_image', '');
|
$rank_image = $request->variable('rank_image', '');
|
||||||
|
|
||||||
// The rank image has to be a jpg, gif or png
|
// The rank image has to be a jp(e)g, gif, png, svg or webp
|
||||||
if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $rank_image))
|
if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg|\.svg|\.webp)$#i', $rank_image))
|
||||||
{
|
{
|
||||||
$rank_image = '';
|
$rank_image = '';
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,7 +479,7 @@ function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perm
|
||||||
/**
|
/**
|
||||||
* Get physical file listing
|
* 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());
|
$matches = array($dir => array());
|
||||||
|
|
||||||
|
|
|
@ -735,6 +735,10 @@ fieldset.polls dd div {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.profile-rank img {
|
||||||
|
max-width: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Post-profile avatars */
|
/* Post-profile avatars */
|
||||||
.postprofile .has-avatar .avatar-container {
|
.postprofile .has-avatar .avatar-container {
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue