# 允许暂停来自某些域的动画图像

**URL:** https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728
**Category:** Feature
**Created:** [2021年五月26日 19:00 UTC](https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728 "2021-05-26T19:00:02Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Heather\_Dudley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heather_dudley/32/151925_2.png) [@Heather\_Dudley](https://meta.discourse.org/u/Heather_Dudley)
#### Post date: [2021年五月26日 19:00 UTC](https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728/1 "2021-05-26T19:00:02Z")

</div>

正如这里讨论的：

> [@Animated gifs: Make it stop!](https://meta.discourse.org/t/animated-gifs-make-it-stop/187607/14?u=heather_dudley):
>
> Thanks Geoff, the technical reason why your upload doesn’t work is because this currently only works for uploads that are in the DB. Your upload above is a giphy URL, it doesn’t have a local upload record. We can’t easily extend this to animated images from other URLs because we don’t know for sure if an asset on a specific URL is an animated image or a regular static image. We can make an educated guess, for giphy URLs for example, but unless the upload is local and processed, we won’t know fo…

由于我的站点规模非常大，而且用户非常喜欢直接链接资源，尤其是超大图片和 GIF，我已关闭了“将远程图片下载到本地”的选项。问题在于，我们同时使用了 Discourse GIF 组件，因此我们包含的 GIF 中 99% 都是远程链接的。

是否可能采用上述提到的“合理推测”机制，为托管在 Giphy 和 Tenor 等主流 GIF 托管网站上的图片启用 GIF 暂停功能？对于托管在各种地方的图片确实无需猜测，但这些主流平台显然属于“合理推测”的范畴。如果没有这项功能，我们的站点将无法真正受益于这一魔法效果，而该功能作为无障碍访问需求已被大量请求。

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [2021年五月26日 19:14 UTC](https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728/2 "2021-05-26T19:14:49Z")

</div>

这对我来说很合理，我们可以假设 URL 中包含 `giphy.com` 或 `tenor.com` 的图片是动图，并允许暂停它们。我应该很快就能添加这个功能。

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [2021年五月27日 20:11 UTC](https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728/4 "2021-05-27T20:11:24Z")

</div>

这现在已通过 [FEATURE: Enable pausing images from Giphy and Tenor (#13185) · discourse/discourse@726500b · GitHub](https://github.com/discourse/discourse/commit/726500bc595524c868f0787202fccac8ef858eba) 完成。请注意，它目前尚未向后应用。（不过，您可以在旧帖子中使用“重建 HTML”选项。）

---

<div class="post-metadata">

### Author: ![Heather\_Dudley](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heather_dudley/32/151925_2.png) [@Heather\_Dudley](https://meta.discourse.org/u/Heather_Dudley)
#### Post date: [2021年五月28日 17:17 UTC](https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728/5 "2021-05-28T17:17:56Z")

</div>

效果非常好，谢谢！

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [2021年六月1日 12:00 UTC](https://meta.discourse.org/t/allow-pause-for-animated-images-from-certain-domains/191728/6 "2021-06-01T12:00:24Z")

</div>

此主题已在 3 天后自动关闭，不再允许新回复。
