From 6854f87c384b2bcf549b9040413052ed67c3038b Mon Sep 17 00:00:00 2001 From: ET-NiK Date: Fri, 8 Aug 2014 18:43:02 +0400 Subject: Using ImagePNG in CAPTCHA helper Using ImagePNG function, if ImageJPG not exists --- system/helpers/captcha_helper.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 74ab24ffb..36a53749f 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -216,8 +216,22 @@ if ( ! function_exists('create_captcha')) // Generate the image // ----------------------------------- $img_url = rtrim($img_url, '/').'/'; - $img_filename = $now.'.jpg'; - ImageJPEG($im, $img_path.$img_filename); + + if (function_exists('ImageJPEG')) + { + $img_filename = $now.'.jpg'; + ImageJPEG($im, $img_path.$img_filename); + } + elseif (function_exists('ImagePNG')) + { + $img_filename = $now.'.png'; + ImagePNG($im, $img_path.$img_filename); + } + else + { + return FALSE; + } + $img = ' '; ImageDestroy($im); -- cgit v1.2.3-24-g4f1b