Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<?php
if (!defined('BASEPATH'))
  exit('No direct script access allowed');


Class Captcha_model extends CI_Model {

  private $vals = array();

  // private $baseUrl  = base_url();
  // private $basePath = 'D:/apache2triad/htdocs/captchademo/';

  // private $captchaImagePath = 'tmp/captcha/';
  // private $captchaImageUrl  = 'tmp/captcha/';
  // private $captchaFontPath  = 'c:/windows/fonts/verdana.ttf';

  public function __construct($configVal = array())
  {
    parent::__construct();

    $this->load->helper('captcha');

    if(!empty($config))
      $this->initialize($configVal);
    else
      $this->vals = array(
                 'word'          => '',
                 'word_length'   => 5,
                 'img_path'      => './assets/captcha/',
                 'img_url'       => './assets/captcha/',
                 'font_path'     => './assets/fonts/Helvetica LT Extra Compressed.ttf',
                 'img_width'     => '300',
                 'img_height'    => '100',
                 'expiration'    => 3600
               );
  }

  /**
   * initializes the variables
   *
   * @author    Mohammad Jahedur Rahman
   * @access    public
   * @param     array     config
   */
  public function initialize ($configVal = array())
  {
    $this->vals = $configVal;
  } //end function initialize

  //---------------------------------------------------------------

  /**
   * generate the captcha
   *
   * @author     Mohammad Jahedur Rahman
   * @access     public
   * @return     array
   */
  public function generateCaptcha ()
  {
    $cap = create_captcha($this->vals);

    return $cap;
  } //end function generateCaptcha
}
?>