有没有人研究过upgradeavatar.php的代码?我也是为了转论坛才刚学php代码的,但我发现是不是这个程序中压根就没有转gif的图片?
请看,这是47-53行的代码:
- $img = new Image_Lite($avatar, $ucavatar);
- if($img->imagecreatefromfunc && $img->imagefunc) {
- if($img->Thumb(120, 120)) {
- $create = TRUE;
- $total++;
- }
- }
复制代码 我跟踪了一下,就是如果是转到gif图片的时候, if($img->Thumb(120, 120))这里都是FALSE,也就不会执行。我们再看一下这个Thumb(x,x)函数,它调用了
function Thumb_GD($thumbwidth, $thumbheight)
这个函数,但这个函数里却有一句:(第330行)
- if(!$this->animatedgif) {
复制代码 所有代码都在大括号里,所以说,程序设定根本就是如果是gif就不执行?
又发现一段有关gif的代码,就是309行- if($this->attachinfo['mime'] == 'image/gif') {
- $fp = fopen($srcfile, 'rb');
- $targetfilecontent = fread($fp, $this->attach['size']);
- fclose($fp);
- $this->animatedgif = strpos($targetfilecontent, 'NETSCAPE2.0') === FALSE ? 0 : 1;
- }
复制代码 实在看不明白这段代码是干什么用的?
不好意思,对PHP半生不熟,期待高手解惑!当然,最终还是要解决GIF头像不能转换的问题! |