Is it possible to lock a file to stop it being opened while GD library is accessing it?
What I am looking to achieve is similar to a database 'serialzable' level of isolation... I want to ensure that only one session/user can access an image at a time to stop a 'dirty read'.
My application allows users to add an image of choice to a bigger image.
for example
I hope that makes it clear enough.
Check out flock. You can either lock the file you're working with, or create a "lock file" somewhere else in the filesystem which all your scripts check for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With