# La sorgente di Avatar è stata modificata ai server Discourse durante la ricostruzione/agiornamento

**URL:** https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416
**Category:** Support
**Created:** [18 Settembre 2015, 12:42am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416 "2015-09-18T00:42:10Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![OnceWas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oncewas/32/40734_2.png) [@OnceWas](https://meta.discourse.org/u/OnceWas)
#### Post date: [18 Settembre 2015, 12:42am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/1 "2015-09-18T00:42:10Z")

</div>

I just rebuilt my development Discourse instance from 1.4b10 to v1.4.0.beta12, and the Discourse-generated letter avatars are now getting pulled from [https://avatars.discourse.org](https://avatars.discourse.org). For example, the URL for my letter avatar for administrator is now [https://avatars.discourse.org/letter/a/f9ae1b/32.png](https://avatars.discourse.org/letter/a/f9ae1b/32.png).

On my production server, which is on 1.4b9, the avatar URL is /letter\_avatar/administrator/32/5\_fcf819f9b3791cb8c87edf29c8984f83.png

My API calls to my 1.4b12 server also show the discrepancy in the avatar URLs:

```
...
["users"]=>
  array(2) {
    [0]=>
    object(stdClass)#630 (3) {
      ["id"]=>
      int(19)
      ["username"]=>
      string(13) "administrator"
      ["avatar_template"]=>
      string(56) "https://avatars.discourse.org/letter/a/f9ae1b/{size}.png"
    }
    [1]=>
    object(stdClass)#629 (3) {
      ["id"]=>
      int(-1)
      ["username"]=>
      string(6) "system"
      ["avatar_template"]=>
      string(52) "/user_avatar/ask.twobydev.com/system/{size}/17_1.png"
    }
  }
  ["user"]=>
  object(stdClass)#659 (29) {
    ["id"]=>
    int(19)
    ["username"]=>
    string(13) "administrator"
    ["avatar_template"]=>
    string(56) "https://avatars.discourse.org/letter/a/f9ae1b/{size}.png"
    ["name"]=>
    string(17) "Two by Fore Admin"
    ["last_posted_at"]=>
    string(24) "2015-08-20T16:57:57.794Z"
    ["last_seen_at"]=>
...

```

Seems odd - and definitely not ideal for all involved - if all my letter avatars are getting pulled from Discourse’s CDN.

1.4b12:

 ![](https://global.discourse-cdn.com/meta/original/3X/1/e/1ee7e50c60be2bd0e0f475f52dfe49ef0a49722d.png)

1.4b9:

 ![](https://global.discourse-cdn.com/meta/original/3X/0/8/08cde1f76730210dae847959a750d27a07bdfd94.png)

---

<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: [18 Settembre 2015, 12:53am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/2 "2015-09-18T00:53:47Z")

</div>

It’s ideal, definitely ideal see

[https://meta.discourse.org/t/optimizing-letter-avatar-rendering/33082](https://meta.discourse.org/t/optimizing-letter-avatar-rendering/33082)

If you don’t like the new default disable it in your site settings

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [18 Settembre 2015, 12:54am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/3 "2015-09-18T00:54:29Z")

</div>

[quote=“sam, post:2, topic:33416”]  
It’s ideal, definitely ideal see  
[/quote]Yup - this is going to save your server a ton of CPU time…

---

<div class="post-metadata">

### Author: ![OnceWas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oncewas/32/40734_2.png) [@OnceWas](https://meta.discourse.org/u/OnceWas)
#### Post date: [18 Settembre 2015, 1:01am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/4 "2015-09-18T01:01:08Z")

</div>

Just caught up on [the avatar discussion](https://meta.discourse.org/t/optimizing-letter-avatar-rendering/33082). Fascinating.

Thanks for the response, I’ll stick with the new avatar service, and modify the API handling in my code to work with the new URLs.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [18 Settembre 2015, 1:52am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/5 "2015-09-18T01:52:22Z")

</div>

Yes the motivation was we noticed we were spending way too much CPU time generating avatars… the [avatars.discourse.org](http://avatars.discourse.org) is a free service behind CloudFlare CDN to speed up all Discourse instances.

---

<div class="post-metadata">

### Author: ![OnceWas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oncewas/32/40734_2.png) [@OnceWas](https://meta.discourse.org/u/OnceWas)
#### Post date: [18 Settembre 2015, 3:15am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/6 "2015-09-18T03:15:46Z")

</div>

I had to disable the service temporarily, at least until I can figure out a reliable way to parse the JSON returned by the `/users/<USERNAME>.json` API endpoint, to determine whether a user has provided their own avatar.

The value returned by `$json->user->avatar_template` is not in a consistent format. If the user has a letter avatar, the value is `https://avatars.discourse.org/letter/r/7cd45c/{size}.png`, but if the user has specified their own avatar, the format is `/user_avatar/<SITENAME>/<USERNAME>/{size}/35_1.png`.

I’ll need to figure out a way to determine when to append the domain name (we use the API to show avatars in Wordpress).

---

<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: [18 Settembre 2015, 3:23am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/7 "2015-09-18T03:23:50Z")

</div>

> [@OnceWas](#):
>
> I’ll need to figure out a way to determine when to append the domain name

That is kind of trivial … if it starts with `/` prepend the domain name 🙂

---

<div class="post-metadata">

### Author: ![OnceWas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oncewas/32/40734_2.png) [@OnceWas](https://meta.discourse.org/u/OnceWas)
#### Post date: [18 Settembre 2015, 3:25am UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/8 "2015-09-18T03:25:53Z")

</div>

When you’ve been starting at a console screen for 12 hours, things seem less trivial 😄

---

<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: [8 Giugno 2024, 12:46pm UTC](https://meta.discourse.org/t/avatar-source-has-changed-to-discourse-servers-on-rebuild-update/33416/9 "2024-06-08T12:46:03Z")

</div>

Questo argomento è stato chiuso automaticamente dopo 3186 giorni. Non sono più consentite nuove risposte.
