#50373 [Asn]: imagepng doesn't doesn't have lockflags
ID: 50373
User updated by: rugkiks at gmail dot com
Reported By: rugkiks at gmail dot com
Status: Assigned
Bug Type: GD related
Operating System: GNU/Linux
PHP Version: 5.3.1
Assigned To: pajoye
New Comment:
Yes, it isn't a big deal, and not breaking my workflow. But i believe
file-locking is there for a reason, and is a neat feature making my
code cleaner :).
Tons of programs solve this by having .lock files, so i guess this is
also an understandable code.
Previous Comments:
------------------------------------------------------------------------
[2009-12-04 00:18:27] rasmus@php.net
I still don't think it is a big deal. Just create a filename.lck file
and lock that while the image is being generated if you need that
feature. It is perhaps 2 extra lines of code.
------------------------------------------------------------------------
[2009-12-04 00:02:20] pajoye@php.net
Let see if we can get something non intrusive without adding yet
another option to this function (already confusing :).
------------------------------------------------------------------------
[2009-12-03 23:55:39] rugkiks at gmail dot com
It's the blocking feature i'm after. When the image is updating,
other fopen's needs to get blocked. It makes my code much more
simpler.
Also, you can do this with ImageMagick, since it allows you to
supply the file handle yourself http://php.net/imagick_writeimagefile
The only reason why i'm requesting this feature to GD, is because of
GD's speed.
rasmus: The renaming-method is nice. But in my case, i need the
users to be blocked until the image is ready. Not just show the old
one, or return a 404. I can program my way out of it, but it's
messy.
I guess i'm saying that it would be nice with a
http://php.net/imagick_writeimagefile for GD.
Thank you for the response.
------------------------------------------------------------------------
[2009-12-03 20:25:58] pajoye@php.net
Same here, I don't see how we could do that for every simple file
related functions. Please follow Rasmus' advice here, best possible
solution.
------------------------------------------------------------------------
[2009-12-03 16:39:32] rasmus@php.net
I'm curious why you want this. Locking is almost never the right
solution for a web app. Writing to a temp file and then atomically
rename it into its final destination. Adding locks to every library
function PHP can call that can potentially write files is not feasible.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50373
--
Edit this bug report at http://bugs.php.net/?id=50373&edit=1
Thread (9 messages)