Re: Default Avatar
Posted: 23 Jun 2010, 20:57
Thanks Ashley, I have updated the code.
Database and Demo for phpBB3 BBCodes, Mods and Smilies
https://phpbb3bbcodes.com/
Stoker ยป 10 Aug 2010, 22:55 wrote:As I wrote here: Re: Default Avatar (Post by apnaitaly #6141)
Code: Select all
$avatar_img = '';
$avatar_max_dimensions = $topic_last_poster_avatar_height = $topic_last_poster_avatar_width = $topic_first_poster_avatar_width = $topic_first_poster_avatar_height = 40;
if ( !empty($row['topic_first_poster_avatar']) || !empty($row['topic_last_poster_avatar']))
{
$avatar_max_dimensions = 40; // here you can change the max-width you would like to have the avatars displayed
if ( !empty($row['topic_first_poster_avatar']))
{
if ( $row['topic_first_poster_avatar_width'] >= $row['topic_first_poster_avatar_height'] )
{
$topic_first_poster_avatar_width = ( $row['topic_first_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_width'] ;
$topic_first_poster_avatar_height = ( $topic_first_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_width'] * $row['topic_first_poster_avatar_height']) : $row['topic_first_poster_avatar_height'] ;
}
else
{
$topic_first_poster_avatar_height = ( $row['topic_first_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_first_poster_avatar_height'] ;
$topic_first_poster_avatar_width = ( $topic_first_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_first_poster_avatar_height'] * $row['topic_first_poster_avatar_width']) : $row['topic_first_poster_avatar_width'] ;
}
}
if ( !empty($row['topic_last_poster_avatar']))
{
if ( $row['topic_last_poster_avatar_width'] >= $row['topic_last_poster_avatar_height'] )
{
$topic_last_poster_avatar_width = ( $row['topic_last_poster_avatar_width'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_width'] ;
$topic_last_poster_avatar_height = ( $topic_last_poster_avatar_width == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_width'] * $row['topic_last_poster_avatar_height']) : $row['topic_last_poster_avatar_height'] ;
}
else
{
$topic_last_poster_avatar_height = ( $row['topic_last_poster_avatar_height'] > $avatar_max_dimensions ) ? $avatar_max_dimensions : $row['topic_last_poster_avatar_height'] ;
$topic_last_poster_avatar_width = ( $topic_last_poster_avatar_height == $avatar_max_dimensions ) ? round($avatar_max_dimensions / $row['topic_last_poster_avatar_height'] * $row['topic_last_poster_avatar_width']) : $row['topic_last_poster_avatar_width'] ;
}
}
}