Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32300 invoked from network); 9 Jan 2017 23:44:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jan 2017 23:44:30 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.20 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.20 mout.gmx.net Received: from [212.227.17.20] ([212.227.17.20:54240] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/40-29702-D5024785 for ; Mon, 09 Jan 2017 18:44:30 -0500 Received: from [192.168.2.109] ([217.82.227.120]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LpsmR-1cvQ7p3rSJ-00ff1L; Tue, 10 Jan 2017 00:44:19 +0100 To: Andrea Faulds , internals@lists.php.net References: <2cee1fe1-6dfd-0337-7286-42f873b9f508@gmx.de> <08.81.31343.C40F3785@pb1.pair.com> Message-ID: <7db42b81-0fc3-c572-8ff4-55af22b60975@gmx.de> Date: Tue, 10 Jan 2017 00:44:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <08.81.31343.C40F3785@pb1.pair.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:gamIpuf6zANnliJX00KSNNTBUNbOUYgTPhpd8KULJJnrRn741F7 BWvYls4T0SKzHHIF0FqgZ/Hhmmrs02UkwWUz84MwfW81ZRMZkjs7cYW1l3+MKnyZ1nbBf/4 wrEE297MBGIL9er2ZYos4VPb1OY+ZO4QKsH0y0RrPHXcwIio9qjHHWCtrvV4QdV/wYSc31p 0+INUVDXfhkNYpguArXsw== X-UI-Out-Filterresults: notjunk:1;V01:K0:OUQ3iEdiHxI=:BMKQR1p643ykx6dDCdY37F J96Z/xvC5qTNa8x0n4dDwBbL1H5aOf8MV4Prchm+yuwdTZD16GEXq/dK1a8N5KG9aUXBbcK+F i+CW8yi9vm2++jEGakowpBI3QY8m4K5vYFtPsNu84+V7nm3txehwRKKM4XDCB4aGdTFGOR8we mkoAPC5XZ1TvFLdaAbOvVO+RVS/1pPwSt/DV8iMb48GU6fD11aQX+XiYCyD0vM57EzmBpxhBG EIfS4pJztXctevq1mp2MVOlr9dqRz5WZhQR5uVAnjJcacVX5+u9ESvrWo1CavDypfCDDbasAS k/IPi24rgE2b/og3zsKgrYYRlC+r7kl5fuRDLueZ049Ga8hu50u1/JCYrHLhcvjD3HrICyMFc UOmADOz9JIHW8ppyP2721OOnrP1vksRvmnHDizVPONFLC80XZviiAvvibsCxGs9nWUx4z84AQ X99Ov4G7r//kegHg6b4Hw6W3H74ceMnZSwYl02mg9Qph82hv107jtqdxE+dPmewCpObWRAi5N i8L7+RhfWz9kkjODHWJujp5MQMVhW3IU2yxAoP2opbLrjV7W6AOnSZB01Zg33TdOEBvACNwPo 1YwQR7p4EHJF8Of3aHnsKaG1PW22JoQswFv7MMlIZ14WDDZPyCsmiL1lzErUTQmu7cZhEwQvP RAuJv5h0j11jXCWIpD6obHUt4oKY+BAxZvNDWxOGTJt+EEC5v6TNMJsFxHbl3fNsSMdd2Vq3I WD7WP5MzlFfBM2reVStdGSCC2y85kPOvSD0dA8qjqna5P1t3x+ww4AWTI+5T6f62ZE89GPP4D XMt4DsY Subject: Re: ext/gd: support creation of animated GIFs From: cmbecker69@gmx.de ("Christoph M. Becker") On 09.01.2017 at 21:19, Andrea Faulds wrote: > Christoph M. Becker wrote: > >> Kalle raised some objections regarding the direct use of streams in the >> API, namely that imagegifanimbegin() expects an open stream to be passed >> as parameter, so perhaps it would be better to accept a stream URL >> instead and manage the stream behind the scenes. That appears to be >> much more solid (as the developer couldn't fiddle with the stream), but >> would require some encapsulation mechanism, either a resource, what >> would be in line with the other GD resource types[4], or an (opaque) >> object, what appears more suitable for PHP 7. >> >> Currently, I'd prefer an *opaque* object which would be created by >> imagegifanimbegin() (creating the respective stream internally), passed >> to imageanimadd() and be destroyed by imagegifanimend(). > > Would this opaque object still allow you to use an arbitrary stream of > your choice? > > Also, like with imagepng() etc., could you stream the output to uh… > PHP's default output stream? (I'm not sure what it's called. The thing > that `echo` goes to.) It would be possible to allow either a stream URL or a stream to given, what would fit to image(png|jpeg|…)(). However, these are "stand-alone" functions which close the stream when they're finished, while the animated GIF writing functions would *allow* the stream to be manipulated by the userland developer, even though I can't see practical reason to do so. And, of course, we could also let the functions accept NULL to directly write to stdout. Passing in 'php://stdout' should have the same effect. > If it does both, I don't have much objection. > > Mind you… is it really necessary to hide the stream from the user? > fopen() is not particularly hard to use, and there are (admittedly > niche) cases where you might want to handle the stream yourself. Are there really such cases? Should we sacrifice the safety of internal stream handling to support some (hypothetical?) use cases? -- Christoph M. Becker