$x = $this->info['width'] - $w;$y = $this->info['height'] - $h;$posx = ($width - $w * $scale) / 2;$posy = ($height - $h * $scale) / 2;do {//创建新图像$img = imagecreatetruecolor($width, $height);// 调整默认颜色$color = imagecolorallocate($img, 255, 255, 255);imagefill($img, 0, 0, $color);//裁剪imagecopyresampled($img, $this->im, $posx, $posy, $x, $y, $neww, $newh, $w, $h);imagedestroy($this->im); //销毁原图$this->im = $img;} while (!empty($this->gif) && $this->gifNext());$this->info['width'] = (int) $width;$this->info['height'] = (int) $height;return $this;/* 固定 */
$x = $this->info['width'] - $w;$y = $this->info['height'] - $h;$posx = ($width - $w * $scale) / 2;$posy = ($height - $h * $scale) / 2;do {//创建新图像$img = imagecreatetruecolor($width, $height);// 调整默认颜色$color = imagecolorallocate($img, 255, 255, 255);imagefill($img, 0, 0, $color);//裁剪imagecopyresampled($img, $this->im, $posx, $posy, $x, $y, $neww, $newh, $w, $h);imagedestroy($this->im); //销毁原图$this->im = $img;} while (!empty($this->gif) && $this->gifNext());$this->info['width'] = (int) $width;$this->info['height'] = (int) $height;return $this;/* 固定 */