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

Fix for image generation fails #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions captcha.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Script para la generaci�n de CAPTCHAS
* Script for generating CAPTCHAS
*
* @author Jose Rodriguez <[email protected]>
* @license GPLv3
Expand All @@ -10,8 +10,15 @@
*
*/


session_start();
// checking if session has been started
if(session_status() == PHP_SESSION_NONE) {
if(headers_sent()) {
trigger_error("Cool PHP Captcha tried to start session but the headers were already sent.", E_USER_ERROR);
exit;
} else {
session_start();
}
}



Expand Down Expand Up @@ -437,7 +444,7 @@ protected function WriteText($text, $fontcfg = array()) {
}
$coords = imagettftext($this->im, $fontsize, $degree,
$x, $y,
$this->GdFgColor, $fontfile, $letter);
$this->GdFgColor, dirname(__FILE__).'/'.$fontfile, $letter);
$x += ($coords[2]-$x) + ($fontcfg['spacing']*$this->scale);
}

Expand Down Expand Up @@ -476,7 +483,7 @@ protected function WaveImage() {
* Reduce the image to the final size
*/
protected function ReduceImage() {
// Reduzco el tama�o de la imagen
// Reduzco el tamaño de la imagen
$imResampled = imagecreatetruecolor($this->width, $this->height);
imagecopyresampled($imResampled, $this->im,
0, 0, 0, 0,
Expand Down