diff options
author | Derek Allard <derek.allard@ellislab.com> | 2008-03-23 17:24:37 +0100 |
---|---|---|
committer | Derek Allard <derek.allard@ellislab.com> | 2008-03-23 17:24:37 +0100 |
commit | be97bdc41601ead493287d67ac80cd5241ddc746 (patch) | |
tree | 3fc984fca42176d590cd140085e5dd84cf6e77d2 /system/plugins/captcha_pi.php | |
parent | 9b808efd5acd2acd17079a54e5282885c1549a84 (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/plugins/captcha_pi.php')
-rw-r--r-- | system/plugins/captcha_pi.php | 10 |
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
|