I'm getting this error message and not sure what's causing it. The author of the code believes that it's a permissions problem, but I thought that I would run it by everyone here and see what everyone has to say.
Basically, a random text string is generated. Then a hash function is applied, and the result is saved as the filename for the image being generated. This is saved as a PNG file. Unfortunately, it seems that the actual step for outputting a GD image stream (in PNG format) to a file is where the error is occurring.
It's in this particular section of code:
<?php
// make a string from the character array
$img_string = implode('', $selected_chars);
// set the filename
$output_filename = sha1($img_string).'.png';
// make the image file
if(!imagepng($dest_img, $output_filename))
{
// clean up
imagedestroy($dest_img);
return FALSE;
}
?>
This particular line:
if(!imagepng($dest_img, $output_filename))
is causing this error:
Warning: imagepng(): Unable to open '7d78ef8d23d490fa5e053809ab32b107c20dca49.png' for writing in /home/virtual/site109/fst/var/www/html/security_image.php on line 156
Anyone have any thoughts on what could be causing this error?