Hi,
I'm in troubles now:
I'm using php_gd.dll for working with images. My code is:
$input = fopen($image_file_url, "rb");
$image_data = fread($input, 2000000);
fclose($input);
$image_file = tmpfile();
$output = fopen($image_file, "w+b");
fwrite($output, $image_data);
fclose($output);
$image_tmp = imageCreateFromPNG ($image_file);
if ($image_tmp) $image_unlink = unlink($image_file);
ImageCopy($image_base, $image_tmp, 0, 0, 0, 0, $map_width, $map_height);
ImageDestroy ( $image_tmp );
Almost every process in this script creates a temp file (for a second) named as "Resource id #X", where X is a number unique for one client, but NOT unique for concurrent client requests!!
It means that in some cases the script crashes with "'Resource id #6' is not a valid PNG file" or "Permission denied" etc.
I have tryied to lock files using flock() - no success.
Is there any way how to synchronize concurrent processes/threads (create a queue)?
Thank you for ANY suggestion!
Pribram