Some thumbs are created on server using shell_exec("/usr/bin/convert -thumbnail..), the files are created properly on server, but file_exists returns false for few seconds after the thumbs are created.
If I add sleep(5) before file_exists then file_exists return true.
Why file_exists returns false?
If sleep(5) added between means creating a file is taking time, means for file_exists() there is a file which is creating and its creation is in progress (as file_exists checks for its physical presence). Try to get success from shell_exec() and only if this returns true go for nest operation.
if ( shell_exec("/usr/bin/convert -thumbnail..) )
file_exists(FILE);