Can't Extend Ccaptchaaction

Hi all, I’ve a problem with the captcha in my contact form.

On the local development system all runs well. On production server the captcha image is shown for just a few times, then it stops showing. The image is shown again only if the server is restarted. For a few times, then… again. :angry:

The sysadmin say me the problem is due to PNG image. So I modified captcha generator, creating a class in the "components" folder, to have JPEG image:




class CCaptchaActionPers extends CCaptchaAction {


    protected function renderImageGD($code) {


        $image = imagecreatetruecolor($this->width, $this->height);

        .....

        header('Pragma: public');

        header('Expires: 0');

        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

        header('Content-Transfer-Encoding: binary');

        header("Content-Type: image/jpeg");

        imagejpeg($image);

        imagedestroy($image);

    }

}



… and declared it in the SiteController:




class SiteController extends CControllerPers {

    .....

    public function actions() {

        return array(

            'captcha' => array(

                'class' => 'CCaptchaActionPers',

                'backColor' => 0xFFFFFF,

                'testLimit' => 1,

            ),

            .....

        );

    }



On the local development system all runs well. On production server… the same as before. :angry: :angry:

Inserting some check instructions I’ve discovered that the extended class CCaptchaActionPers is ignored and the standard one is called in its place.

In the “Captcha Extended” extension page, the author says to register class path. I think it’s not needed for me, but…




class CControllerPers extends CController {

    public function init() {

        parent::init();

        Yii::$classMap = array_merge(Yii::$classMap, array(

            'CCaptchaActionPers' => Yii::getPathOfAlias('application.components') . DIRECTORY_SEPARATOR . 'CCaptchaActionPers.php',

                ));

    }



Nothing changes.

Someone on the forum says there is a problem with captcha when SiteController is extended more than once, and I have this situation:




class CControllerPers extends CController {

....

class SiteController extends CControllerPers {



Modifying class declaration to extend SiteController directly from CController, the result is the same. :angry: :angry: :angry:

I don’t know what can I do more… Does someone can help me?

Nobody has idea about this problem?