Action Captcha Don't Generate Image

HI :)

In the begin of my project i made register system with captcha…

Now i want check my work and i get nice suprise…

Captcha picture doesn’t generate…

It’s my code :


	public function actions()


		return array(

			// captcha action renders the CAPTCHA image displayed on the contact page






			// page action renders "static" pages stored under 'protected/views/site/pages'

			// They can be accessed via: index.php?r=site/page&view=FileName






Model :

array('captcha', 'captcha', 'allowEmpty'=> !CCaptcha::checkRequirements(),'on'=>'register'),

maybe is something wrong in urlmanager in config/main?









				//array('news/show', 'pattern'=>'news/show/<id:\d+>', 'verb'=>'GET'),




When i go to link - http://localhost/index.php/site/captcha in normal case, it should send me picture with captcha. Now, it’s writing error that picture contained a errors

Please help :(



I SPEND 3 hours for this problem :

my index.php :

<?php //echo dirname(__FILE__) ; ?>

<?php //echo dirname(__FILE__).'/../../yiiroot/framework/yii.php'; ?>

<?php //echo dirname(__FILE__).'/protected/config/main.php'; ?>


// change the following paths if necessary





// remove the following lines when in production mode

defined('YII_DEBUG') or define('YII_DEBUG',true);

// specify how many levels of call stack should be shown in each log message

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);




I had to delete firstly 3 lines and now all go right…

But is my next question is…

WHY ??????????????

Maybe the space/linebreak resolves in some output and if headers are sent, if messes up your session. Captcha needs it I guess.

Yii Captcha is problematic ;)

does your captcha action restricted by accessRules. if yes then make sure to allow all users to access captcha action

If you are talking about the 3 echo lines, then yii is sending http text headers BEFORE the captcha command can send the http IMAGE headers. I would guess this would mess up the browser. not knowing if it’s a picture or text?

Why you had those echo lines in the first place seems weird, other than for testing and should have been removed anyway.