php - How to flock() an image? -


I'm looking at an image flock ().

Currently I am using the following

  $ img = ImageCreateFromPng ($ img_path); Swarm ($ img, LOCK_EX);  

It seems that the file handle of the GD library is not valid with the bunch. How can I swap the file using this image?

function swarm works only on file handles (or if they are locking So, if you want to lock an image while reading it, you have to open it twice:

  $ f = fopen ($ imgpath, 'r'); If (! $ F) {// handle error (file probably does not exist, or no permission?)} If (swarm ($ F, LOCK_EX)) {$ img = imagecreatefrompng ($ imgPath); // ... your belongings are flock here ($ F, LOCK_UN); } Fclose ($ f);  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -