SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing the captcha txt size?

    Hey All,

    First off I hope this is in the correct section, If not please move.

    Ok, I am trying to set my captcha txt size, It is really small.

    Here is a copy of the code I have

    Code:
    <?php
    
    require_once( '../inc/header.inc.php' );
    require_once( BX_DIRECTORY_PATH_INC . 'images.inc.php' );
    
    ob_start();
    $chars = array("a","b","c","d","e","f","h","i","k","m","n","o","r","s","t","u","v","w","x","z","2","3","4","5","6","7","8","9");
    /*
    $chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J",
    			   "k","K","L","m","M","n","N","o","p","P","q","Q","r","R","s","S","t","T",
    			   "u","U","v","V","w","W","x","X","y","Y","z","Z","2","3","4","5","6","7","8","9");
    */
    
    $textstr = '';
    for ($i = 0, $length = 6; $i < $length; $i++)
       $textstr .= $chars[rand(0, count($chars) - 1)];
    
    $hashtext = md5($textstr);
    setcookie('strSec', $hashtext, 0, '/');
    
    if ( produceSecurityImage( $textstr, $hashtext ) != IMAGE_ERROR_SUCCESS )
    {
    	// output header
    	header( "Content-Type: image/gif" );
    	
        header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
        header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
        header( "Cache-Control: no-store, no-cache, must-revalidate" );
        header( "Cache-Control: post-check=0, pre-check=0", false );
        header( "Pragma: no-cache" );
    	
    	// output error image
    	@readfile( $dir['profileImage'] . 'simg_error.gif' );
    }
    
    ob_end_flush();
    ?>
    I tried

    $size = rand(12, 14); and $charSize = 48;

    neither of them worked



    Any help would be appreciated.
    Thanks In Advance

    David

  2. #2
    SitePoint Wizard Blake Tallos's Avatar
    Join Date
    Jun 2008
    Location
    Cuyahoga Falls, Ohio.
    Posts
    1,511
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by laflair13 View Post
    Hey All,

    First off I hope this is in the correct section, If not please move.

    Ok, I am trying to set my captcha txt size, It is really small.

    Here is a copy of the code I have

    Code:
    <?php
    
    require_once( '../inc/header.inc.php' );
    require_once( BX_DIRECTORY_PATH_INC . 'images.inc.php' );
    
    ob_start();
    $chars = array("a","b","c","d","e","f","h","i","k","m","n","o","r","s","t","u","v","w","x","z","2","3","4","5","6","7","8","9");
    /*
    $chars = array("a","A","b","B","c","C","d","D","e","E","f","F","g","G","h","H","i","I","j","J",
                   "k","K","L","m","M","n","N","o","p","P","q","Q","r","R","s","S","t","T",
                   "u","U","v","V","w","W","x","X","y","Y","z","Z","2","3","4","5","6","7","8","9");
    */
    
    $textstr = '';
    for ($i = 0, $length = 6; $i < $length; $i++)
       $textstr .= $chars[rand(0, count($chars) - 1)];
    
    $hashtext = md5($textstr);
    setcookie('strSec', $hashtext, 0, '/');
    
    if ( produceSecurityImage( $textstr, $hashtext ) != IMAGE_ERROR_SUCCESS )
    {
        // output header
        header( "Content-Type: image/gif" );
        
        header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
        header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
        header( "Cache-Control: no-store, no-cache, must-revalidate" );
        header( "Cache-Control: post-check=0, pre-check=0", false );
        header( "Pragma: no-cache" );
        
        // output error image
        @readfile( $dir['profileImage'] . 'simg_error.gif' );
    }
    
    ob_end_flush();
    ?>
    I tried

    $size = rand(12, 14); and $charSize = 48;

    neither of them worked



    Any help would be appreciated.

    Im sorry, but its not in the right Forum. Ill pm, a moderator to have them move your thread for you.
    Blake Tallos - Software Engineer for Sanctuary
    Software Studio, Inc. C# - Fanatic!
    http://www.sancsoft.com/


  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $size = rand(12, 14); and $charSize = 48;
    Where is this line in your posted code? I think this line is in the included file "BX_DIRECTORY_PATH_INC . 'images.inc.php'". Can you please post the code (function produceSecurityImage($textstr, $hashtext)) here so that we can see how they have set the font size?

    And i don't think that you posted it in the wrong forum since it is the PHP Captcha and the fonts sizes are set from PHP itself.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  4. #4
    SitePoint Guru laflair13's Avatar
    Join Date
    Nov 2004
    Location
    TN
    Posts
    629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rajug View Post
    Where is this line in your posted code? I think this line is in the included file "BX_DIRECTORY_PATH_INC . 'images.inc.php'". Can you please post the code (function produceSecurityImage($textstr, $hashtext)) here so that we can see how they have set the font size?

    And i don't think that you posted it in the wrong forum since it is the PHP Captcha and the fonts sizes are set from PHP itself.
    Thanks for your help, I found it and fixed it in the images.inc.php, I just didnt know where to look
    Thanks In Advance

    David


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •