# 默认不再支持动画 GIF 头像

**URL:** https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224
**Category:** Announcements
**Created:** [2020年十月14日 18:51 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224 "2020-10-14T18:51:01Z")
**Posts on this page:** 20
**Page:** 1

<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: [2020年十月14日 18:51 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/1 "2020-10-14T18:51:02Z")

</div>

为简化 Discourse 代码库，自当前的 2.6 beta 版本起，Discourse 默认将不再支持动画 GIF 头像。

[![](https://media.tenor.com/images/8cf675c4eb56287c439749c1b2878ba1/tenor.gif) ](https://media.tenor.com/images/8cf675c4eb56287c439749c1b2878ba1/tenor.gif)

请注意，帖子中的动画 GIF 将继续正常工作（当然！），我们 **此处仅特指头像** 。

未来可能会有插件为有此需求的站点重新启用动画 GIF 头像支持，但目前我们尚未制定该插件的时间表。

---

<div class="post-metadata">

### Author: ![nildarar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nildarar/32/331927_2.png) [@nildarar](https://meta.discourse.org/u/nildarar)
#### Post date: [2020年十月15日 06:56 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/2 "2020-10-15T06:56:45Z")

</div>

我觉得我们很快就要爆发内战了：😅

---

<div class="post-metadata">

### Author: ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)
#### Post date: [2020年十月15日 13:52 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/3 "2020-10-15T13:52:53Z")

</div>

我猜支持 SVG 头像后，SVG 动画也能正常工作了。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2020年十月15日 14:06 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/4 "2020-10-15T14:06:42Z")

</div>

在 Discord 上，我们无法上传 SVG 格式的自定义表情符号，因为矢量图形可能会引发问题。

> SVG 的渲染复杂度可以任意高（想象一个包含渲染数十万条贝塞尔曲线指令的 SVG 文件）。这意味着有人可以构造一个 SVG，导致客户端在尝试渲染时变慢甚至卡死，而且很难开发出可靠的启发式算法来检测这种情况。
> 
> 内置表情符号可以是 SVG，因为它们显然不是恶意的，但我们无法对自定义表情符号做出同样的保证。

我想任何允许用户上传 SVG 文件的应用都会面临同样的问题，但我不确定是否可以设置某些限制来减少潜在风险。

---

<div class="post-metadata">

### Author: ![anon89147131](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@anon89147131](https://meta.discourse.org/u/anon89147131)
#### Post date: [2020年十月15日 14:54 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/5 "2020-10-15T14:54:58Z")

</div>

哎呀！真糟糕，我的动态头像在新版 Discourse 实例上无法使用了。我建议可以在 app.yml 中添加一行，与主机名行类似，以便启用该功能。当然，这需要大量工作，并且要等到非常靠后的版本更新中才能实现。

`#GIF_avatars: Y（默认禁用）`

---

<div class="post-metadata">

### Author: ![Anatolia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anatolia/32/133777_2.png) [@Anatolia](https://meta.discourse.org/u/Anatolia)
#### Post date: [2020年十月22日 20:05 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/7 "2020-10-22T20:05:25Z")

</div>

如果用户通过链接从外部网站上传动态头像，是否会导致同样的问题？

---

<div class="post-metadata">

### Author: ![Neris](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neris/32/199483_2.png) [@Neris](https://meta.discourse.org/u/Neris)
#### Post date: [2020年十一月7日 13:26 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/8 "2020-11-07T13:26:47Z")

</div>

看起来这个改动也影响了动态自定义表情。我可是吃过大亏才发现的：试图更新现有的表情集，结果全变成了静态图片。现在甚至没法回滚了。😢

---

<div class="post-metadata">

### Author: ![REALITY](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/reality/32/199798_2.png) [@REALITY](https://meta.discourse.org/u/REALITY)
#### Post date: [2020年十二月9日 22:23 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/21 "2020-12-09T22:23:54Z")

</div>

你好，这管用吗？因为我试遍了所有方法，但没有任何进展。

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2020年十二月9日 23:47 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/22 "2020-12-09T23:47:40Z")

</div>

不，正如原帖所述，我们已移除了对 GIF 头像的支持。

---

<div class="post-metadata">

### Author: ![bohrasd](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bohrasd/32/203547_2.png) [@bohrasd](https://meta.discourse.org/u/bohrasd)
#### Post date: [2020年十二月17日 04:03 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/23 "2020-12-17T04:03:13Z")

</div>

用户卡片呢？

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2020年十二月17日 04:21 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/24 "2020-12-17T04:21:48Z")

</div>

用户卡片上仍然正常运行，请查看我的示例。

我们已移除对头像的支持，因为头像需要频繁调整大小，而用户卡片中不存在这个问题。

---

<div class="post-metadata">

### Author: ![bohrasd](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bohrasd/32/203547_2.png) [@bohrasd](https://meta.discourse.org/u/bohrasd)
#### Post date: [2020年十二月17日 05:49 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/25 "2020-12-17T05:49:25Z")

</div>

我在生产环境中运行的是 2.6.0 版本，当我上传 GIF 到用户卡片时，它完全没有动画效果。我注意到上传的 GIF 被转换成了静态图片。我需要更改任何设置吗？目前我的站点设置中没有 `allow_animated_avatars` 或 `allow_animated_thumbnails` 选项。

---

<div class="post-metadata">

### Author: ![bohrasd](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bohrasd/32/203547_2.png) [@bohrasd](https://meta.discourse.org/u/bohrasd)
#### Post date: [2020年十二月17日 06:11 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/26 "2020-12-17T06:11:12Z")

</div>

我刚下载了你们的 GIF 并上传到我的用户卡片，但即使在这里也不起作用：😅

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2021年四月13日 18:48 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/29 "2021-04-13T18:48:01Z")

</div>

> [@bohrasd](#):
>
> 用户卡片怎么样？

再次跟进一下，你可以使用 animated WebP 作为用户卡片的背景。我刚更新了这里的示例以便测试。

---

<div class="post-metadata">

### Author: ![ykcorner](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ykcorner/32/217259_2.png) [@ykcorner](https://meta.discourse.org/u/ykcorner)
#### Post date: [2021年五月25日 04:44 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/30 "2021-05-25T04:44:28Z")

</div>

有没有人开发过能让这个正常运行的插件？

---

<div class="post-metadata">

### Author: ![Drakon74](https://avatars.discourse-cdn.com/v4/letter/d/e9a140/32.png) [@Drakon74](https://meta.discourse.org/u/Drakon74)
#### Post date: [2021年六月1日 18:38 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/31 "2021-06-01T18:38:06Z")

</div>

我附议这个问题。那边有什么进展吗？

---

<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: [2021年六月1日 23:51 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/32 "2021-06-01T23:51:45Z")

</div>

恐怕没有开发任何插件，如果要保留旧功能，插件将会非常复杂。

我们过去使用库：[Gifsicle: Command-Line Animated GIFs](https://www.lcdf.org/gifsicle/) 来调整动态头像的大小，但该依赖已被移除。

要在插件中实现，有以下几种选择：

1. 以某种方式引入该依赖，这非常复杂，尤其是从插件层面引入，然后修改代码以在插件中支持此功能（极其困难）

2. 放弃调整动态头像大小的功能，并为插件添加补丁（中等难度）

3. 找出其他调整动态头像大小的方法并将其集成到插件中（极其困难）

Discourse 团队目前并未安排任何相关实验。我们已完全暂时放弃了动态头像的想法。

---

<div class="post-metadata">

### Author: ![Ubik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ubik/32/89095_2.png) [@Ubik](https://meta.discourse.org/u/Ubik)
#### Post date: [2021年六月6日 10:04 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/33 "2021-06-06T10:04:19Z")

</div>

> [@Falco](#):
>
> 在用户卡片上仍然可以正常工作，请查看我的。

在我管理的论坛上，这些功能已无法使用，无论是用户卡片还是个人资料页眉图片。用户可以保留现有的内容，但如果他们尝试更新，只会显示为静态图片。

> [@Falco](#):
>
> 再次回到这个话题，你可以使用动画 WebP 作为用户卡片的背景。

我尝试上传不同的 WebP 文件，无论是作为帖子内容还是用户卡片背景，都收到了以下提示：

 ![invalid](https://global.discourse-cdn.com/meta/original/3X/c/3/c376214ba84ccbad5bb0d47284befe7a9b3690d7.jpeg)

这是我们的用户非常喜爱的一个功能，他们通常会在个人资料页面上投入大量精力。请问有人能提供建议吗？

---

<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: [2021年六月6日 19:36 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/34 "2021-06-06T19:36:53Z")

</div>

这并不容易，因为正如你上方帖子中所示，我们已从应用构建流程中移除了对动画 GIF 的依赖。

---

<div class="post-metadata">

### Author: ![Ubik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ubik/32/89095_2.png) [@Ubik](https://meta.discourse.org/u/Ubik)
#### Post date: [2021年六月7日 04:47 UTC](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224/35 "2021-06-07T04:47:26Z")

</div>

是的，我理解 GIF 可能已无法使用，这确实令人遗憾。当我尝试上传 WebP 文件时，出现上述提示可能是什么原因？

[下一頁](https://meta.discourse.org/t/animated-gif-avatars-no-longer-supported-by-default/167224.md?page=2)
