PHP Gif GD 库动画丢失仅显示第一帧
我在使用 GD 库时遇到问题。
当我使用 imagecreatefromgif
或类似的东西时,对于已经有动画的 gif,我只显示一个帧。没有动画所以。
我已经尝试了网络上的一切,但没有结果。您知道如何使用 GD 库正确显示 GIF 动画吗?当我看到那些没有动画的图像时,真是令人沮丧......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
虽然我个人从未遇到过它们,但据说 GD 库对创建动画 GIF 文件有一些 GIF 支持。来自常见问题解答:
然而,据我所知,它没有读取动画 GIF 的功能。
如果您想要 ImageMagick,您必须转向 处理动画 GIF。
While I personally have never come across them, the GD library is said to have some GIF support for creating animated GIF files. From the FAQ:
However, as far as I know, it has no capabilities to read animated GIFs.
You will have to turn to ImageMagick if you want to process animated GIFs.
GD 做不到。方法是安装ImageMagick(在服务器上)。然后你向它发出一个命令来执行你想要的操作。
例如,要调整动画 gif 的大小:
另请参阅:[1], [2]
You can't do it with GD. The way to do it is to have ImageMagick installed (on the server). Then you shell out a command to that to do what you want.
E.g., to resize an animated gif:
See also: [1], [2]
也许您想检查SVGDreams 库。它是一个支持 ajax 和键盘的 SVG 动画库。
May be you'd like to check SVGDreams library. It's an SVG animation library with ajax and keyboard support.