我可以使用php和gd检测GIF动画吗? [英] Can I detect animated gifs using php and gd?
问题描述
我目前在使用GD调整图像大小时遇到一些问题.
I'm currently running into some issues resizing images using GD.
一切正常,直到我想调整动画gif的大小为止,它会在黑色背景上提供第一帧.
Everything works fine until i want to resize an animated gif, which delivers the first frame on a black background.
我尝试使用getimagesize
,但这仅给我尺寸,没有任何区别,可以区分任何gif和动画.
I've tried using getimagesize
but that only gives me dimensions and nothing to distinguish between just any gif and an animated one.
动态gif不需要实际调整大小,只要能够跳过它们就足够了.
Actual resizing is not required for animated gifs, just being able to skip them would be enough for our purposes.
有任何线索吗?
PS.我无权使用imagemagick.
PS. I don't have access to imagemagick.
亲切的问候,
克里斯
推荐答案
imagecreatefromgif()
函数的PHP手册页上有简短的代码片段,应该是您所需要的:
There is a brief snippet of code in the PHP manual page of the imagecreatefromgif()
function that should be what you need:
imagecreatefromgif
评论#59787,由ZeBadger
imagecreatefromgif
comment #59787 by ZeBadger
这篇关于我可以使用php和gd检测GIF动画吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!