This seems a duplace question some how, but its not. Am asking the following :
Does the codeingiter helper does have a font size increasing feature ? even if i passed the following array setting seems not change.
‘font_size’ => 36
2.The font i used has the following font sizes , but still no change to captcah size
So what is the matter ?
/* Setup config to pass into the create_captcha function */ $capache_config = array( 'img_path' => 'captcha/', 'img_url' => base_url() . 'captcha/', 'img_width' => '150', 'font_path' => base_url() . 'captcha/font/captcha4.ttf', 'img_height' => 40, 'expiration' => 7200 ); /* Generate the captcha */ $captcha = create_captcha($capache_config);
But the size is i can’t get it larger even if i increased width or height ? Any thing you know about this ?
Advertisement
Answer
Easier solution 🙂
1.Goto this file yourapplication
->system
–helpers
->captcha_helper.php
2.Find the following line and apply change as you want i.e we change font size of the default captcha font size helpers settings.
NB.You can move the entier file to you application/core and suffix the file with MY.
$font_size = 28; //edited font for captcha size modification
// ----------------------------------- // Write the text // ----------------------------------- $use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE; if ($use_font == FALSE) { $font_size = 5; $x = rand(0, $img_width/($length/3)); $y = 0; } else { $font_size = 28; //edited font for captcha size $x = rand(0, $img_width/($length/1.5)); $y = $font_size+2; }
3.Clear catch on your testing browser 4.Modify helper configuration on your controller or other places like FCPATH IS A MUST Thanks machineaddict!
$capache_config = array( 'img_path' => 'captcha/', 'img_url' => base_url() . 'captcha/', 'img_width' => '290', 'font_path' => FCPATH . 'captcha/font/captcha4.ttf', 'img_height' => 65, 'expiration' => 7200 );
Expected Output :
BANG BANG I HIT THE GROUND !!!!