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



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



and this is what i want

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


but in firefox it looks like this


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