
Much appreciated
Code: Select all
//-- mod : apiv ----------------------------------------------------------------
//-- add
function user_display_avatar($row, $prefix = '', $tpl_switch, $display)
{
if ( !$display || empty($row[$prefix . '_poster_avatar']) )
{
return;
}
global $config, $template;
$avatar = unserialize($row[$prefix . '_poster_avatar']);
if ( $avatar['width'] >= $avatar['height'] )
{
$avatar_width = ($avatar['width'] > $config['avatar_max_dimensions']) ? $config['avatar_max_dimensions'] : $avatar['width'];
$avatar_height = ($avatar_width == $config['avatar_max_dimensions']) ? round($config['avatar_max_dimensions'] / $avatar['width'] * $avatar['height']) : $avatar['height'];
}
else
{
$avatar_height = ($avatar['height'] > $config['avatar_max_dimensions']) ? $config['avatar_max_dimensions'] : $avatar['height'];
$avatar_width = ($avatar_height == $config['avatar_max_dimensions']) ? round($config['avatar_max_dimensions'] / $avatar['height'] * $avatar['width']) : $avatar['width'];
}
$template->alter_block_array($tpl_switch, array(
strtoupper($prefix) . '_POSTER_AVATAR' => get_user_avatar($avatar['avatar'], $avatar['type'], $avatar_width, $avatar_height),
strtoupper($prefix) . '_POSTER_AVATAR_MARGIN' => ($avatar_width == $config['avatar_max_dimensions']) ? 5 : ($config['avatar_max_dimensions'] - $avatar_width + 5),
), true, 'change');
}
//-- fin mod : apiv ------------------------------------------------------------
Code: Select all
//-- mod : apiv ----------------------------------------------------------------
//-- add
function user_display_avatar($row, $prefix = '', $tpl_switch, $display)
{
if ( !$display || empty($row[$prefix . '_poster_avatar']) )
{
return;
}
global $config, $template;
$avatar = unserialize($row[$prefix . '_poster_avatar']);
if ( $avatar['width'] >= $avatar['height'] )
{
$avatar_width = ($avatar['width'] > $config['avatar_max_dimensions']) ? $config['avatar_max_dimensions'] : $avatar['width'];
$avatar_height = ($avatar_width == $config['avatar_max_dimensions']) ? round($config['avatar_max_dimensions'] / $avatar['width'] * $avatar['height']) : $avatar['height'];
$avatar_max_dimensions = $avatar_width = $avatar_height = 40;
}
else
{
$avatar_height = ($avatar['height'] > $config['avatar_max_dimensions']) ? $config['avatar_max_dimensions'] : $avatar['height'];
$avatar_width = ($avatar_height == $config['avatar_max_dimensions']) ? round($config['avatar_max_dimensions'] / $avatar['height'] * $avatar['width']) : $avatar['width'];
$avatar_max_dimensions = $avatar_width = $avatar_height = 40;
}
$template->alter_block_array($tpl_switch, array(
strtoupper($prefix) . '_POSTER_AVATAR' => get_user_avatar($avatar['avatar'], $avatar['type'], $avatar_width, $avatar_height),
strtoupper($prefix) . '_POSTER_AVATAR_MARGIN' => ($avatar_width == $config['avatar_max_dimensions']) ? 5 : ($config['avatar_max_dimensions'] - $avatar_width + 5),
), true, 'change');
}
//-- fin mod : apiv ------------------------------------------------------------