Warning: The author of this contribution does not provide support for it anymore.

Avatar of poster on Index and Viewforum

Default avatar thumb in viewforum - Avatar of poster on Index and Viewforum

Re: Default avatar thumb in viewforum

by Boardtalk.net » Sat Apr 23, 2011 12:01 am

Thanks lefty74, great work ;)
Much appreciated
User avatar
Boardtalk.net
Registered User
Posts: 1245
Joined: Fri Jun 05, 2009 8:12 pm
Location: Ireland
Name: Colette

Re: Default avatar thumb in viewforum

by herz » Mon Dec 24, 2012 2:34 am

7emper5i wrote:It worked, but just for ... 95%... (just a guess).

As you can see on the screenshot I use the TUX-"No-Avatar".

Image

I've already run your script "avatar_update.php" again and, of yourse, purged the cache and refreshed the template.

Do you have a clue, what that might cause?


sory poor english , tested problem Avatar of poster on Index and Viewforum & random avatar"no_avatar" in localhost fixing this bug.

open incudes/function_display.php
find

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 ------------------------------------------------------------


and replace with

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 ------------------------------------------------------------


thanks for mod lefty ;)
herz
Registered User
Posts: 1
Joined: Mon Dec 24, 2012 1:54 am

Re: Default avatar thumb in viewforum

by mikedijital » Fri Dec 28, 2012 11:24 pm

This right here IS the fix for this, after 1 hour of googling, this fixed the oversized avatar and the weird space on the side !!! Thank you soooo much herz
mikedijital
Registered User
Posts: 39
Joined: Fri Dec 28, 2012 6:05 am

Re: Default avatar thumb in viewforum

by mr.ruf » Sun Dec 15, 2013 3:36 am

thanks , this fix works cool with Avatar of poster on Index and Viewforum 1.3.0 & defaut ramdom "No Avatar"
GREATTTTTTTTTTTTTTTTTTT !!!!!!
User avatar
mr.ruf
Registered User
Posts: 136
Joined: Thu Apr 04, 2013 11:12 pm
Location: PuErTo RiCo
Name: Harold