mirror of
https://gitee.com/fastadminnet/think-captcha.git
synced 2026-10-29 03:48:20 +08:00
优化 php8 兼容
This commit is contained in:
@@ -235,7 +235,9 @@ class Captcha
|
|||||||
// 输出图像
|
// 输出图像
|
||||||
imagepng($this->im);
|
imagepng($this->im);
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
imagedestroy($this->im);
|
if (PHP_VERSION_ID < 80000) {
|
||||||
|
imagedestroy($this->im);
|
||||||
|
}
|
||||||
|
|
||||||
return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/png');
|
return response($content, 200, ['Content-Length' => strlen($content)])->contentType('image/png');
|
||||||
}
|
}
|
||||||
@@ -338,7 +340,9 @@ class Captcha
|
|||||||
// Resample
|
// Resample
|
||||||
$bgImage = @imagecreatefromjpeg($gb);
|
$bgImage = @imagecreatefromjpeg($gb);
|
||||||
@imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height);
|
@imagecopyresampled($this->im, $bgImage, 0, 0, 0, 0, $this->imageW, $this->imageH, $width, $height);
|
||||||
@imagedestroy($bgImage);
|
if (PHP_VERSION_ID < 80000) {
|
||||||
|
@imagedestroy($bgImage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 加密验证码 */
|
/* 加密验证码 */
|
||||||
|
|||||||
Reference in New Issue
Block a user