#50373 [Bgs->Asn]: imagepng doesn't doesn't have lockflags
ID: 50373
Updated by: pajoye@php.net
Reported By: rugkiks at gmail dot com
-Status: Bogus
+Status: Assigned
Bug Type: GD related
Operating System: GNU/Linux
PHP Version: 5.3.1
-Assigned To:
+Assigned To: pajoye
New Comment:
Let see if we can get something non intrusive without adding yet
another option to this function (already confusing :).
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2009-12-03 12:31:19] rugkiks at gmail dot com
Description:
------------
http://php.net/imagepng
Apparently there is not way to lock files while writing to them.
I'd like to see a similar behavior like the flags in
http://php.net/file_put_contents
Maybe the file actually get's locked. I can't test it.
Reproduce code:
---------------
---
From manual page: function.imagepng#Description
---
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50373&edit=1
Thread (9 messages)