From 0ef93646615516ae2bc87e54894708adaa29700f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 7 Nov 2017 15:30:36 +0200 Subject: Implement data:image URIs in CAPTCHA helper Also, switched to PNG by default and dropped JPEG; refactored image files GC. Close #5200 --- user_guide_src/source/changelog.rst | 7 ++++++- user_guide_src/source/helpers/captcha_helper.rst | 11 ++++------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'user_guide_src') diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 0a625d861..0e766166e 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -89,7 +89,6 @@ Release Date: Not Released - Removed previously deprecated :doc:`Security Helper ` function ``do_hash()`` (use PHP's native ``hash()`` instead). - Removed previously deprecated :doc:`File Helper ` function ``read_file()`` (use PHP's native ``file_get_contents()`` instead). - Added new function :php:func:`ordinal_format()` to :doc:`Inflector Helper `. - - Added 'img_alt' option to :php:func`create_captcha()` :doc:`CAPTCHA Helper ` with a default value of 'captcha'. - :doc:`Download Helper ` changes include: @@ -113,6 +112,12 @@ Release Date: Not Released - Removed previously deprecated function ``form_prep()`` (use :php:func:`html_escape()` instead). - Removed the second (out of three) parameter from the :php:func:`form_upload()` function (it was never used). + - :doc:`CAPTCHA Helper ` changes include: + + - Added 'img_alt' option with a default value of 'captcha'. + - Added ability to generate ``data:image/png;base64`` URIs instead of writing image files to disk. + - Updated to always create PNG images instead of JPEG. + Version 3.1.7 ============= diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst index 986c1d3e1..bdf33c2a1 100644 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ b/user_guide_src/source/helpers/captcha_helper.rst @@ -50,7 +50,8 @@ Once loaded you can generate a CAPTCHA like this:: echo $cap['image']; - The captcha function requires the GD image library. -- Only the **img_path** and **img_url** are required. +- The **img_path** and **img_url** are both required if you want to write images to disk. + To create ``data:image/png;base64`` images, simply omit these options. - If a **word** is not supplied, the function will generate a random ASCII string. You might put together your own word library that you can draw randomly from. @@ -89,10 +90,6 @@ Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this:: $this->load->helper('captcha'); - $vals = array(      - 'img_path' => './captcha/',      - 'img_url' => 'http://example.com/captcha/'      - ); $cap = create_captcha($vals); $data = array(      @@ -155,10 +152,10 @@ The following functions are available: The **image** is the actual image tag:: - + The **time** is the micro timestamp used as the image name without the file extension. It will be a number like this: 1139612155.3422 The **word** is the word that appears in the captcha image, which if not - supplied to the function, will be a random string. \ No newline at end of file + supplied to the function, will be a random string. -- cgit v1.2.3-24-g4f1b