I have the same problem, but my GD extension is installed correctly :
my user models :
<?php
class user extends CActiveRecord
{
public $verifyCode;
[...]
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd')),
[...]
public function attributeLabels()
{
return array(
'verifyCode'=>'Code de verification',
[...]
?>
my UserController :
<?php
[...]
public function actions()
{
return array(
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0xEBF4FB,
),
);
}
[...]
?>
and my _form
<?php if(extension_loaded('gd')): ?>
<div class="row">
<?php echo $form->labelEx($model,'verifyCode'); ?>
<div>
<?php $this->widget('CCaptcha'); ?>
<?php echo $form->textField($model,'verifyCode'); ?>
</div>
<div class="hint">Veuillez retapez les lettres que vous voyer sur l'image.
<br/>Les caractères ne sont pas sensible à la case.</div>
</div>
<?php endif; ?>
I also have a problem with captcha. I see the input field and "reload captcha" link, but I do not see the image itself. When I look into HTML source of generated page, <img> tag is there, but it has a problem with rendering image.
I have tried everything you advice here, Guys, and it still does not work… So:
I do have GD module loaded. There is a condition
if (extension_loaded('gd'))
before showing any part of this.
I do have an action defined in controller and I do have permissions for it.
When I try to open index.php?r=<yourcontrollername>/captcha I do not see 403 but an image broken while rendering. (Chrome shows a missing image icon. Firefox shows information: "image can not be displayed, because it contains errors".) So it is not a permission issue.
And now the strangest part: I have captcha used in the other part of the site (yii-user extension) and… it works perfectly. Of course everything: view, controller are pretty much the same.
I really have no idea what is going wrong. Any guesses?
Thanks. I do not speak French, unfortunately, but as far as I understood this is more or less what is described here: http://saptarshi.org/post/6/Yii%3A+Adding+captcha+to+comments.htm The problem is that I have exactly followed this instructions and it is not working…
OK, I know what is the reason. It is the charset issue.
I have to use URF-8 in my application. When I change the coding of a file to UTF-8 captcha is not working. When I change it back to ANSI – it is ok again.
I do have a same problem and did follow all above step by step codes and still having same problem.
I also have this …blogdemo-enhanced application installed and it shows image on that form and I did compare word by word in all …Model…Controller…Views but still image doesn’t show up on my another application Comment Form.
But there is one thing on my blog application Contact form the image shows up but on Comment Form doesn’t.
I spend the whole day to find it out but finally give up…
Finally I just did figure out why Captcha image doesn’t show up on my comment form as I did follow step by step code in Controller, Modell and View.
The problem I found out in urlManager’=>array(…) in main.php file I just disable the entire block and wola it works then I manage my URL the way I want and then enable urlManager’=>array(…) and now every things working fine.
So make it sure that your URL are ok as still I didn’t gone through in deep in this problem as why it happened so make also sure the above post solution as it also caused by with some guys.
Hello. I have the same problem. I have tried all solutions presented here. I use Unicode (UTF-8, no BOM) I have also zaped Gremlins just in case there could be any ASCII in there, but I didn’t find any. I also have tried to change the encoding scheme from ASCII to UTF 8 and back. with and without boom (original encoding was UTF-8, no boom). The blog application that follows the yii installation has a captcha that works and when i move the demo Blog to my webserver it works with captcha out of the box, but not from the same webserver on my new site.
I get this message in firefox when trying to call captcha alone from the site controller:
Such a subtle and invisible mistake. I am not sure if it is due to a change between ASCII and UTF8 or the change from Windows oriented line breaks to Unix, but I think it was the editor. I have been changing editors during the last weeks so that might explain it.
Be careful about the text encoding boys and girls.
I have bad experience with cpatacha image before but I found the solution around many issues depend on your settings but the
first and big reason which affect capatcha image is the encoding of index.php for intro run page , main.php in config folder you should encode it with utf-8 with out BOM , I used notepad++ to did that .
second reason : the access rules . but when I CHECK other demos test i did not find any related access rules with capatcha .