Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't find font file in ccaptchaaction #638

Closed
manuel-84 opened this issue Apr 25, 2012 · 8 comments
Closed

can't find font file in ccaptchaaction #638

manuel-84 opened this issue Apr 25, 2012 · 8 comments
Milestone

Comments

@manuel-84
Copy link

in CCaptchaAction please change line 143 from

$this->fontFile = dirname(__FILE__) . '/Duality.ttf';

to

$this->fontFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Duality.ttf';

this resolve this error on windows

[error] [php] imagettfbbox() [function.imagettfbbox]: Problem loading glyph (\yii-1.1.10.r3566\framework\web\widgets\captcha\CCaptchaAction.php:246)

@samdark
Copy link
Member

samdark commented Apr 25, 2012

Hmm… captcha works fine for me and I'm under windows.

@manuel-84
Copy link
Author

This happens almost randomly. All was working fine for me too, until you asked me to try code from master, I tried flushing cache and assets of my app but the error won't fix until I've added DIRECTORY_SEPARATOR.
Restarting Apache seems to fix the problem too but why don't close any problem definitely fixing this line...this is so trivial..

The correct line of code to edit was 243 not 143

@suralc
Copy link
Contributor

suralc commented Apr 25, 2012

'/' should not be a problem as any Windows(and DOS >= 2) should understand that.

http://alanhogan.com/tips/php/directory-separator-not-necessary

edit: googled and corrected

@manuel-84
Copy link
Author

I know that.. and I'm on win64

@samdark
Copy link
Member

samdark commented Apr 25, 2012

@manuel-84 Are you sure this change really fixes your problem? To me it looks like it was fixed somehow differently and the change itself isn't necessary.

@suralc
Copy link
Contributor

suralc commented Apr 25, 2012

Works fine for me on win 7 x64 and latest ubuntu server(as virtual machine).
Tested with master.

is your apache/windows config messed up somehow?

@manuel-84
Copy link
Author

I can reproduce this error switching the framework version behind my app (last-release vs master-repo) and then returning back to the original.
The result is

2012/04/25 16:50:45 [error] [php] imagettfbbox() [function.imagettfbbox]: Problem loading glyph (D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\widgets\captcha\CCaptchaAction.php:246)
Stack trace:
#0 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\actions\CAction.php(75): CCaptchaAction->run()
#1 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\CController.php(309): CCaptchaAction->runWithParams()
#2 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\filters\CFilterChain.php(134): UserController->runAction()
#3 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\filters\CFilter.php(41): CFilterChain->run()
#4 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\CController.php(1146): CAccessControlFilter->filter()
#5 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\filters\CInlineFilter.php(59): UserController->filterAccessControl()
#6 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter()
#7 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\CController.php(292): CFilterChain->run()
#8 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\CController.php(266): UserController->runActionWithFilters()
#9 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\CWebApplication.php(276): UserController->run()
#10 D:\xampp\htdocs\yii-1.1.10.r3566\framework\web\CWebApplication.php(135): CWebApplication->runController()
#11 D:\xampp\htdocs\yii-1.1.10.r3566\framework\base\CApplication.php(162): CWebApplication->processRequest()
#12 D:\xampp\htdocs\liberos\index.php(16): CWebApplication->run()
REQUEST_URI=/myapp/user/captcha?v=4f980f4535c3f
in D:\xampp\htdocs\myapp\index.php (16)

And the only 2 way to fix that are restart Apache or add directory_separator

@suralc can you try to reproduce it?

@klimov-paul
Copy link
Member

Issue resolved by commit f0a04d3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants