summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorDerek Allard <derek.allard@ellislab.com>2008-03-23 17:24:37 +0100
committerDerek Allard <derek.allard@ellislab.com>2008-03-23 17:24:37 +0100
commitbe97bdc41601ead493287d67ac80cd5241ddc746 (patch)
tree3fc984fca42176d590cd140085e5dd84cf6e77d2 /system
parent9b808efd5acd2acd17079a54e5282885c1549a84 (diff)
Modified captcha generation to first look for the function imagecreatetruecolor, and fallback to imagecreate if it isn't available (#4226).
Diffstat (limited to 'system')
-rw-r--r--system/plugins/captcha_pi.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/system/plugins/captcha_pi.php b/system/plugins/captcha_pi.php
index 693fd9117..7aa31efb1 100644
--- a/system/plugins/captcha_pi.php
+++ b/system/plugins/captcha_pi.php
@@ -244,7 +244,15 @@ function create_captcha($data = '', $img_path = '', $img_url = '', $font_path =
// Create image
// -----------------------------------
- $im = ImageCreate($img_width, $img_height);
+ // PHP.net recommends imagecreatetruecolor(), but it isn't always available
+ if (function_exists(imagecreatetruecolor))
+ {
+ $im = imagecreatetruecolor($img_width, $img_height);
+ }
+ else
+ {
+ $im = imagecreate($img_width, $img_height);
+ }
// -----------------------------------
// Assign colors