# Size topic avatar

**URL:** https://meta.discourse.org/t/size-topic-avatar/80112
**Category:** Support
**Created:** [February 8, 2018, 3:44pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112 "2018-02-08T15:44:47Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![luckydev](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@luckydev](https://meta.discourse.org/u/luckydev)
#### Post date: [February 8, 2018, 3:44pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/1 "2018-02-08T15:44:47Z")

</div>

Hello!  
How to make size avatar topic 145px?

 ![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://global.discourse-cdn.com/meta/original/3X/4/f/4f0ede2403006492a49da44ff33a8c19222907e8.png)

---

<div class="post-metadata">

### Author: ![mikechristopher](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mikechristopher/32/89135_2.png) [@mikechristopher](https://meta.discourse.org/u/mikechristopher)
#### Post date: [February 8, 2018, 4:04pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/2 "2018-02-08T16:04:34Z")

</div>

As said before @luckydev - if you want to start editing things you will need to start learning some CSS - or at least searching on the forum here for some previous posts.

I found this by just searching…

[https://meta.discourse.org/t/css-help-please-resizing-avatar-in-posts-from-45-to-120/24234/5?u=mikechristopher](https://meta.discourse.org/t/css-help-please-resizing-avatar-in-posts-from-45-to-120/24234/5)

---

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [February 8, 2018, 4:09pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/3 "2018-02-08T16:09:35Z")

</div>

This requires changing CSS. Here’s a basic example to start with that increases the size from 45px to 60px.

```CSS

.topic-avatar {
    width: 60px; // increases the width of the avatar container
    img.avatar { // increases the size of the avatar
        width: 60px;
        height: 60px;
    }
}

```

As the above post mentioned, there are topics that cover this specific question in various ways here on Meta. It might be more productive to search before asking.

[https://meta.discourse.org/t/how-to-change-topic-avatar-size/20689](https://meta.discourse.org/t/how-to-change-topic-avatar-size/20689)

---

<div class="post-metadata">

### Author: ![luckydev](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@luckydev](https://meta.discourse.org/u/luckydev)
#### Post date: [February 8, 2018, 8:09pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/4 "2018-02-08T20:09:31Z")

</div>

Avatar quality deteriorated

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 8, 2018, 9:28pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/5 "2018-02-08T21:28:02Z")

</div>

Yeah, you are going to need a theme component here and possibly to amend the `avatar sizes` to fit the new size + x2 of the size for retina.

You basically need to redo the widget to support this, its a rather hairy change, I totally support making this more easily customizable long term.

@eviltrout what the cleanest way of amending “settings” in the post-avatar widget, so size is something else? would reopen widget be able to pull this off?

---

<div class="post-metadata">

### Author: ![luckydev](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@luckydev](https://meta.discourse.org/u/luckydev)
#### Post date: [February 8, 2018, 9:35pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/6 "2018-02-08T21:35:49Z")

</div>

How can I change it? Sorry for my language, I’m from Russia.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 8, 2018, 9:37pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/7 "2018-02-08T21:37:37Z")

</div>

> [@luckydev](#):
>
> How can I change it? Sorry for my language, I’m from Russia

This is not your fault here, changing this is a very advanced level change. It requires a theme component. Hold tight a few days while we have a think about this.

---

<div class="post-metadata">

### Author: ![luckydev](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@luckydev](https://meta.discourse.org/u/luckydev)
#### Post date: [February 8, 2018, 9:40pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/8 "2018-02-08T21:40:50Z")

</div>

OK thank you very much!

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [February 8, 2018, 9:54pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/9 "2018-02-08T21:54:20Z")

</div>

Widget settings are easily changed via API:

```plaintext
api.changeWidgetSetting('post-avatar', 'size', 'super-huge');

```

You will need to define what `super-huge` is elsewhere though. But any of our default sizes will work as a parameter.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 8, 2018, 9:57pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/10 "2018-02-08T21:57:44Z")

</div>

Cool, @vinothkannans can you post an example theme component in the #plugin:theme category that demonstrates how to make a poster avatar say 105px square, or some other non standard larger size?

---

<div class="post-metadata">

### Author: ![luckydev](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@luckydev](https://meta.discourse.org/u/luckydev)
#### Post date: [February 8, 2018, 11:34pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/11 "2018-02-08T23:34:07Z")

</div>

Thanks!  
Its work

```plaintext
<script type="text/discourse-plugin" version="0.4">
    api.changeWidgetSetting('post-avatar', 'size', '70');
</script>
```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 9, 2018, 1:58am UTC](https://meta.discourse.org/t/size-topic-avatar/80112/12 "2018-02-09T01:58:01Z")

</div>

@Osama this is an interesting use case for you “theme settings”

- It is a component
- It should remind users they need to also amend the site setting
- It has a param that goes in the HEADER and in CSS

I think you should try it out, maybe post a screen shot here of how it would work?

---

<div class="post-metadata">

### Author: ![luckydev](https://avatars.discourse-cdn.com/v4/letter/l/eb8c5e/32.png) [@luckydev](https://meta.discourse.org/u/luckydev)
#### Post date: [February 9, 2018, 10:20pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/13 "2018-02-09T22:20:26Z")

</div>

Because of the avatar, there were problems with indenting

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/1/f15a94b1b55d1eaa82b8135f4328f93078ebd4be.jpg)

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [February 12, 2018, 10:09pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/14 "2018-02-12T22:09:12Z")

</div>

Ok so I tried this and it worked quite nicely. Here is what I did:

1. created a theme and made it a component for my default theme

2. defined an enum setting in the component theme and gave it some values to choose from  

3. added this piece of code in Common \>\> \</head\>:

```html
<script type="text/discourse-plugin" version="0.4">
    api.changeWidgetSetting('post-avatar', 'size', Discourse.ThemeSettings.topic_avatars_size);
</script>

```

1. and this piece in Common \>\> CSS

```scss
.topic-avatar {
    width: #{$topic_avatars_size}px; /* from theme settings */
}

```

And I got this (80px avatars):

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/1/c17201c23fb57206aac410e09440c92ac5d862ed.jpg)

Changed the setting to 100px, reloaded the page and got 100px avatars:

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/6/06f12abc2d6e6d1391a6b81c7aa3222b7742e0d9.jpg)

My PR for theme settings doesn’t have this - if you want this in I’ll push my changes after I polish my code a bit and write some tests.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 12, 2018, 10:11pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/15 "2018-02-12T22:11:02Z")

</div>

> [@Osama](#):
>
> My PR for theme settings doesn’t have this - if you want this in I’ll push my changes after I polish my code a bit and write some tests.

Absolutely, basing these kind of features on real world usage is the bestest ever ❤

Let me know once that is done and I would love to get this merged in!

Also, how does it get the `enum` cause it would have to be based off the site setting (loosly) cause the site setting accounts for x2 sizes to allow for retina?

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [February 12, 2018, 11:04pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/16 "2018-02-12T23:04:34Z")

</div>

Currently the enum choices are purely set by the theme developer and they will need to remind the theme user i.e. admin to make sure the `avatar sizes` site setting has the selected value for the theme.

Though to be clear, that theme setting doesn’t have to be strictly an enum (it could work as an integer/string setting, theme users would have to manually type the value they want).

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 13, 2018, 12:29am UTC](https://meta.discourse.org/t/size-topic-avatar/80112/17 "2018-02-13T00:29:21Z")

</div>

> [@Osama](#):
>
> Though to be clear, that theme setting doesn’t have to be strictly an enum (it could work as an integer/string setting, theme users would have to manually type the value they want).

Yes I think that is a better call here for this particular setting, I would just use an int and maybe have a min / max defined by theme dev.

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [February 15, 2018, 8:43pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/18 "2018-02-15T20:43:20Z")

</div>

Alright PR is now updated:

[https://github.com/discourse/discourse/pull/5562](https://github.com/discourse/discourse/pull/5562)

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2024, 12:43pm UTC](https://meta.discourse.org/t/size-topic-avatar/80112/19 "2024-06-08T12:43:29Z")

</div>

This topic was automatically closed after 2311 days. New replies are no longer allowed.
