Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Cottelletje - maaliskuu 22, 2006, 10:01:04 AP

Otsikko: avatar background
Kirjoitti: Cottelletje - maaliskuu 22, 2006, 10:01:04 AP
how do you put around a avatar(always 100x100x pixels) a white background but the avatar has to be in the center otherwise its all screwed up
i found a code from somebody but it doesn't work good this is the result :

// Show avatars, images, etc.
if (!empty($settings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
<div style="overflow: auto; width: 100%; background-color: #FFFFFF; padding: 3px; border: 1px solid #F6F6F6;">', $message['member']['avatar']['image'], '</div><br />';

and this is the result but it should be on both sides even

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi2.photobucket.com%2Falbums%2Fy42%2FCottelletje%2Favatar_bg.gif&hash=e8538b8376f4ecfbf89b730c7845fa0df431ba2d)

whats the problem?
Otsikko: Re: avatar background
Kirjoitti: Thantos - maaliskuu 22, 2006, 10:04:07 AP
<div style="overflow: auto; width: 100%; background-color: #FFFFFF; padding: 3px; border: 1px solid #F6F6F6; text-align: center;">', $message['member']['avatar']['image'], '</div><br />';

Will do it I believe.
Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 22, 2006, 10:15:29 AP
no it doesn't work if i use that this is the result

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi2.photobucket.com%2Falbums%2Fy42%2FCottelletje%2Favatar_bg2.gif&hash=edd880b08c5d88dd901367274f03726b93b3d0f0)

and this is what i want

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi2.photobucket.com%2Falbums%2Fy42%2FCottelletje%2Favatar_bg_good.gif&hash=82ad279b74c2cb0c0bd0db9b7dc5501055572110)
Otsikko: Re: avatar background
Kirjoitti: Thantos - maaliskuu 22, 2006, 10:18:00 AP
then take off the width part of the style.
Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 22, 2006, 10:28:33 AP
if i do that it is whole screwed up ...
if i change width to 100px its ok in IE but in Firefox the bottom is much larger around the avatar  ???
Otsikko: Re: avatar background
Kirjoitti: Acf - maaliskuu 22, 2006, 03:08:40 IP
How about browser detect then?
style="' , !$context['browser']['is_ie'] ? 'valeu true' : 'valeu false', '"
Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 22, 2006, 03:30:17 IP
don't now what you mean by that acf

it looks now in ie like this
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi2.photobucket.com%2Falbums%2Fy42%2FCottelletje%2Fie_1.gif&hash=c82663fa8e5f43d5afc0246dbb923bcde2dd4453)

but in firefox it looks like this
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi2.photobucket.com%2Falbums%2Fy42%2FCottelletje%2Ffire_2.gif&hash=8ff4f0d3f71f5cc1274c9c3840049add7d484be4)

so what is the **** problem :-X
Otsikko: Re: avatar background
Kirjoitti: Acf - maaliskuu 22, 2006, 03:33:24 IP
For example you can set style padding x in ff and padding y in ie

style="' , !$context['browser']['is_ie'] ? 'FF' : 'IE', '"
Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 22, 2006, 03:42:42 IP
where in that line do i set the padding,can't see a ...px?
Otsikko: Re: avatar background
Kirjoitti: Acf - maaliskuu 22, 2006, 04:04:00 IP
cause i did not make the example that way.
this will remove 3 px of padding at the bottom.
style="overflow: auto; width: 100%; background-color: #FFFFFF; ' , !$context['browser']['is_ie'] ? 'padding-left: 3px; padding-right: 3px; padding-top: 3px; padding-bottom: 0px; : 'padding: 3px;', '  border: 1px solid #F6F6F6;"

Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 23, 2006, 07:55:14 AP
thats very complicated man for such a small thing? ;D
Otsikko: Re: avatar background
Kirjoitti: Acf - maaliskuu 23, 2006, 12:39:21 IP
its just a ifelse statement ;)
Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 24, 2006, 07:24:05 AP
so just need to put that code in the file? ::)
Otsikko: Re: avatar background
Kirjoitti: Acf - maaliskuu 24, 2006, 09:02:46 AP
You could try to do that :)

But i am not sure if its effective enough to solve your problem. I could take closer look at it if you could post your display.template.php and style.css, so i can put it on my localserver(rc2) and look closer at it.
Otsikko: Re: avatar background
Kirjoitti: Cottelletje - maaliskuu 24, 2006, 07:36:41 IP
its okay i fixed it  ;D