From c225aa9002676b0d1dff51940175544d36667d8c Mon Sep 17 00:00:00 2001 From: tianya Date: Thu, 20 Aug 2020 09:45:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=9C=A8=E4=B8=8D=E6=94=AF?= =?UTF-8?q?=E6=8C=81GD=E5=BA=93=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E8=83=BD=E5=A4=9F=E6=AD=A3=E5=B8=B8=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plus/vdimgck.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/plus/vdimgck.php b/src/plus/vdimgck.php index cf2b07c4..c298df88 100755 --- a/src/plus/vdimgck.php +++ b/src/plus/vdimgck.php @@ -35,12 +35,23 @@ if (!echo_validate_image($config)) // 如果不成功则初始化一个默认验证码 @session_start(); $_SESSION['securimage_code_value'] = strtolower('abcd'); - $im = @imagecreatefromjpeg(DEDEINC.'/data/vdcode.jpg'); - header("Pragma:no-cache\r\n"); - header("Cache-Control:no-cache\r\n"); - header("Expires:0\r\n"); - imagejpeg($im); - imagedestroy($im); + if (function_exists('imagecreatefromjpeg')) { + $im = @imagecreatefromjpeg(DEDEINC.'/data/vdcode.jpg'); + header("Pragma:no-cache\r\n"); + header("Cache-Control:no-cache\r\n"); + header("Expires:0\r\n"); + imagejpeg($im); + imagedestroy($im); + } else { + header("Pragma:no-cache\r\n"); + header("Cache-Control:no-cache\r\n"); + header("Expires:0\r\n"); + $c = file_get_contents(DEDEINC.'/data/vdcode.jpg',true); + $size = filesize(DEDEINC.'/data/vdcode.jpg'); + header ('Content-Type: image/x-icon'); + header ("Content-length: $size"); + echo $c; + } } function echo_validate_image( $config = array() )