Can anyone help me with this nonsense problem?
<?php
if(!readfile($path))
{
$error = error_get_last();
imageError('*'.$error['type'].','.$error['message'].','.$error['file'].','.$error['line'].'*'); // Outputs the error on an image
exit;
}
?>
This outputs an image showing “,,,” – basically the error is empty.
I think the problem can be related to the fact that I’m trying to read the same file 10 times in the same moment. I’ve something like this:
<img src="images/10/seo-friendly.jpg" />
<img src="images/10/seo-friendly2.jpg" />
<img src="images/10/seo-friendly3.jpg" />
<img src="images/10/seo-friendly4.jpg" />
<img src="images/10/seo-friendly5.jpg" />
<img src="images/10/seo-friendly6.jpg" />
<img src="images/10/seo-friendly7.jpg" />
<img src="images/10/seo-friendly8.jpg" />
<img src="images/10/seo-friendly9.jpg" />
<img src="images/10/seo-friendly10.jpg" />
Then I have a rewrite rule in my .htaccess like:
RewriteRule images/([0-9]+)/.*\.(png|jpg|gif) resize.php?id=$1 [L]
So, what happens is that I basically request the same file 10 times in the same moment. Most of the times it works properly, but sometimes I get that problem (just for 1-3 of the 10 images).
Any clue is really appreciated.
Thank you.
The problem was due to bad concurrency. I was obviously trying to read an image while writing on it (or vice versa)