是否可以检测动画gif图像客户端? [英] Is it possible to detect animated gif images client side?

查看:112
本文介绍了是否可以检测动画gif图像客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以检测动画gif图像客户端?

Is it possible to detect animated gif images client side?

在Internet Explorer中,您可以使用 onload 事件,因为它将被触发每帧加载(IE8中的行为已更改) 。

In Internet Explorer you can use the onload event for this, since it willl be fired for every frame loaded (behaviour changed in IE8).

但是其他浏览器也有办法吗?

But is there a way for other browsers too?

推荐答案

我不知道在客户端有什么办法,但我不确定。您可以做的是解析服务器端的HTML代码和任何引用的gif,并为这些图像添加一个类。但这并不是真的值得推荐,因为它至少需要对每个gif进行HTML +解析。正如您可以从这个PHP示例中看到的那样,检查就CPU负载而言,GIF也不是一件容易的事。

I don't know of any way to do it on the client side, but I am not sure about that. What you could do, is parsing the HTML code and any referenced gif on the server side and add a class to these images. But that is not really recommended because it involves at least one additional parsing of HTML + parsing of every gif. As you can see from this example in PHP, checking the gifs is also not trivial in terms of CPU load.

这篇关于是否可以检测动画gif图像客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆