EDIT: For some obscure reason, just changing to another color, worked. I tried that before, but it seems to happen with some specific colors. In this case 0x000000. I later tried 0x111111 and 0x222222, and both worked. I have no clue why 000000 didn’t work, since that color worked perfectly in my machine. More than a fix, it’s a workaround, since I don’t know if this happens with other colors.
END EDIT
I had captcha working just fine in my laptop localhost, but once I moved the application to the server, the captcha stopped working. I directly opened the captcha action, and it’s throwing an exception which I don’t exactly know how to fix. Google isn’t being particularly helpful right now (or I suck at searching)
Happens in line 297 of CCaptchaAction:
$backColor=new ImagickPixel('#'.dechex($this->backColor));
The above is the first line of the renderImageImagick function (github.com/yiisoft/yii/blob/1.1.13/framework/web/widgets/captcha/CCaptchaAction.php)
The server seems to have GD support, and I didn’t change anything when uploading the application to the server.
This is the phpinfo information:
And this is the action in my controller
/**
* Declares class-based actions.
*/
public function actions()
{
return array(
// captcha action renders the CAPTCHA image displayed on the contact page
'captcha'=>array(
'class'=>'CCaptchaAction',
'backColor'=>0x000000,
'foreColor'=>0xFFFFFF,
'testLimit'=>1
),
);
}
The captcha being used:
<span class="add-on"><?php echo $form->labelEx($model,'verifyCode'); ?></span>
<?php echo $form->textField($model,'verifyCode'); ?>
<?php echo $form->error($model,'verifyCode'); ?>
And my model has the verifyCode property:
public $verifyCode;//To use in the public registration form
Any clues? EVERYTHING was working perfectly fine in localhost, at least in regards to the captcha.