Yii Framework Forum: Captcha image issue. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Captcha image issue. Rate Topic: -----

#1 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 144
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 30 May 2009 - 10:21 PM

I am following the blog tutorial but am stuck at adding the captcha image into the add comment form.

The image source is not of an image but the local path of  src="/index.php?r=post/captcha".

How is this happening? Can I not run this from my local machine?


0

#2 User is offline   DarkNSF 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 287
  • Joined: 12-November 08
  • Location:Palm Bay, Florida

Posted 30 May 2009 - 10:31 PM

in that particular uri, php changes the headers to image/jpeg.. so that the browser knows to render it like an image. check this link:

http://www.electrict...ge-headers-php/


it may not render on your computer because you need the php extension gd2. are you using wamp on windows or are you in a linux environment?
0

#3 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 144
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 31 May 2009 - 11:34 PM

Thanks for the reply.

I don't quite understand. The URI index.php?r=post/captcha should display the captcha image? If that was the case then I would think that the URL http://www.yiiframew...?r=post/captcha would also show a captcha image.

I am running Linux and gd2 and php5-gd are both installed. I have tried this on two computers now running the same set-up.
0

#4 User is offline   qwerty 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 290
  • Joined: 20-November 08

Posted 01 June 2009 - 12:14 AM

Hi,
have you any errors when you go to page e.g. http://localhost/myw...?r=post/captcha ?
0

#5 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 144
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 01 June 2009 - 12:36 AM

It gives me the login screen. If I'm logged in it returns a Unauthorized error which tells me I need to change the accessRules.

I have fixed this error by adding 'captcha' to the actions array in AccessRules() in PostController.

Thank you.
0

#6 User is offline   qwerty 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 290
  • Joined: 20-November 08

Posted 01 June 2009 - 01:15 AM

Hi,
in your post controller (PostController.php) you have to allow captcha action for all users or authenticated. For all users you can do



I hope that this help you :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users