 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
aman@pear
Joined: 16 Aug 2008 Posts: 1
|
Posted: Fri Oct 03, 2008 8:56 am Post subject: file_put_contents(.png) [function.file-put-contents]: |
|
|
file_put_contents(.png) [function.file-put-contents]: failed to open stream
This is the error coming when i am running a script like
require_once 'Text/CAPTCHA.php';
require_once 'Image/Text.php';
// Set CAPTCHA options (font must exist!)
$imageOptions = array(
'font_size' => 24,
'font_path' => './',
'font_file' => 'arial.TTF',
'text_color' => '#DDFF99',
'lines_color' => '#CCEEDD',
'background_color' => '#555555'
);
// Set CAPTCHA options
$options = array(
'width' => 200,
'height' => 80,
'output' => 'png',
'imageOptions' => $imageOptions
);
// Generate a new Text_CAPTCHA object, Image driver
$c = Text_CAPTCHA::factory('Image');
$retval = $c->init($options);
if (PEAR::isError($retval)) {
printf('Error initializing CAPTCHA: %s!',
$retval->getMessage());
exit;
}
// Get CAPTCHA secret passphrase
$_SESSION['phrase'] = $c->getPhrase();
// Get CAPTCHA image (as PNG)
$png = $c->getCAPTCHAAsPNG();
if (PEAR::isError($png)) {
echo 'Error generating CAPTCHA!';
echo $png->getMessage();
exit;
}
file_put_contents((session_id()) . '.png', $png); |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Fri Oct 03, 2008 4:07 pm Post subject: Re: file_put_contents(.png) [function.file-put-contents]: |
|
|
| aman@pear wrote: | file_put_contents(.png) [function.file-put-contents]: failed to open stream
[...]
file_put_contents((session_id()) . '.png', $png); |
Not really a question that is related to PEAR ...
It helps to read the PHP manual:
| Quote: |
Return Values
session_id() returns the session id for the current session or the empty string ("") if there is no current session (no current session id exists).
|
http://www.php.net/manual/en/function.session-id.php |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|