securimage_show.php 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * Project: Securimage: A PHP class for creating and managing form CAPTCHA images<br />
  4. * File: securimage_show.php<br />
  5. *
  6. * Copyright (c) 2013, Drew Phillips
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without modification,
  10. * are permitted provided that the following conditions are met:
  11. *
  12. * - Redistributions of source code must retain the above copyright notice,
  13. * this list of conditions and the following disclaimer.
  14. * - Redistributions in binary form must reproduce the above copyright notice,
  15. * this list of conditions and the following disclaimer in the documentation
  16. * and/or other materials provided with the distribution.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  22. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  23. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  24. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  25. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  26. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. * Any modifications to the library should be indicated clearly in the source code
  31. * to inform users that the changes are not a part of the original software.<br /><br />
  32. *
  33. * If you found this script useful, please take a quick moment to rate it.<br />
  34. * http://www.hotscripts.com/rate/49400.html Thanks.
  35. *
  36. * @link http://www.phpcaptcha.org Securimage PHP CAPTCHA
  37. * @link http://www.phpcaptcha.org/latest.zip Download Latest Version
  38. * @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation
  39. * @copyright 2013 Drew Phillips
  40. * @author Drew Phillips <drew@drew-phillips.com>
  41. * @version 3.5.2 (Feb 15, 2014)
  42. * @package Securimage
  43. *
  44. */
  45. // Remove the "//" from the following line for debugging problems
  46. // error_reporting(E_ALL); ini_set('display_errors', 1);
  47. require_once dirname(__FILE__) . '/securimage.php';
  48. $img = new Securimage();
  49. // You can customize the image by making changes below, some examples are included - remove the "//" to uncomment
  50. //$img->ttf_file = './Quiff.ttf';
  51. //$img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC; // show a simple math problem instead of text
  52. //$img->case_sensitive = true; // true to use case sensitve codes - not recommended
  53. //$img->image_height = 90; // height in pixels of the image
  54. //$img->image_width = $img->image_height * M_E; // a good formula for image size based on the height
  55. //$img->perturbation = .75; // 1.0 = high distortion, higher numbers = more distortion
  56. //$img->image_bg_color = new Securimage_Color("#0099CC"); // image background color
  57. //$img->text_color = new Securimage_Color("#EAEAEA"); // captcha text color
  58. //$img->num_lines = 8; // how many lines to draw over the image
  59. //$img->line_color = new Securimage_Color("#0000CC"); // color of lines over the image
  60. //$img->image_type = SI_IMAGE_JPEG; // render as a jpeg image
  61. //$img->signature_color = new Securimage_Color(rand(0, 64),
  62. // rand(64, 128),
  63. // rand(128, 255)); // random signature color
  64. // see securimage.php for more options that can be set
  65. // set namespace if supplied to script via HTTP GET
  66. if (!empty($_GET['namespace'])) $img->setNamespace($_GET['namespace']);
  67. $img->show(); // outputs the image and content headers to the browser
  68. // alternate use:
  69. // $img->show('/path/to/background_image.jpg');