Skip to content

Commit

Permalink
captcha bugs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
steevenz committed Apr 11, 2018
1 parent 280eb44 commit 195ce21
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Protections/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,14 @@ public function regenerate()
*/
public function getImage()
{
$tempFilePath = tempnam(
sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'o2system' . DIRECTORY_SEPARATOR,
'captcha'
);
if(class_exists('O2System\Framework')) {
$tempFilePath = @tempnam(PATH_CACHE, 'captcha');
} else {
$tempFilePath = @tempnam(
sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'o2system' . DIRECTORY_SEPARATOR,
'captcha'
);
}

if ( $image = imagecreatetruecolor( 200, 50 ) ) {
$backgroundColor = imagecolorallocate( $image, 255, 255, 255 );
Expand Down

0 comments on commit 195ce21

Please sign in to comment.