Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97746 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99283 invoked from network); 13 Jan 2017 17:56:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2017 17:56:31 -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:49249] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/04-00729-BC419785 for ; Fri, 13 Jan 2017 12:56:30 -0500 Received: from [192.168.2.109] ([217.82.227.120]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MFi1J-1cFjlP2MrN-00Eblb; Fri, 13 Jan 2017 18:56:18 +0100 To: Andrea Faulds , internals@lists.php.net References: <2cee1fe1-6dfd-0337-7286-42f873b9f508@gmx.de> <08.81.31343.C40F3785@pb1.pair.com> <7db42b81-0fc3-c572-8ff4-55af22b60975@gmx.de> <0F.87.55699.8E435785@pb1.pair.com> Message-ID: Date: Fri, 13 Jan 2017 18:56:26 +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: <0F.87.55699.8E435785@pb1.pair.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:02KEZEJo0kPOQIOzePK9WZ60jf7BNgtruNJ1wgkxOP36tnnCaSh iFA81cPniPA75PO8mxtkEFBU42EkpQit1u3Qdclb1xhiAwMIZFHAj4EjAsGoFGs65Gn3NHz VB9uSsblmE+2i9N2/Ip0Fpy3EO3tnzGnWFiqhn9OI2Nlh6OSjPxa3HaZ6RHKzNkSBdtiYJs QFosSftaiGNRTM9x5UZpA== X-UI-Out-Filterresults: notjunk:1;V01:K0:WvFxCkCB6Q0=:CzhBvxN4/GoBrrCMRWXuBP JxS83JjMrA8aXU0qOsHr1mOT/iFOLPEyNvsLg1amD0OylKfqU7RB5Qu2uyyaDB82FaHVoEswq tz2gSL6lrMp8I0JF3AtsDWWXjeUIwYgKDBCocAGMZ47M38z/6jJT3vyavz6QFmvmSrqPE2f+0 XILubN9OHDkpYJBY7cusLskcJTY6H1gAKbY1vDWTxqyPCbEhg0TFZhuGWr2zpGn9AiwkQS6o9 9evj8vkucZ7JZmQrzNAxG8u14eFvUhpK4luf5TCq8Khyjrqdfb383AhvSv+Gt3+slkxeBJVE5 U6PDnUjVPx0pXsNE/OtVKwhmefI1a0XazVoKw2YpQhU/3WX0+RNW3da2cdHfX29wATQ0IZFEz gm/rKWGRfkTvVdmtzJqZjUwZxMiTtFmsV7Ycm+e+RtW06s6diHdeZuPtkEDSRZs5j9IXfkc6Q qdTwwbyrfLMiwhmBxITeAvKglsFCvor5MVRPVLpfraFkJBLmnix2Q/PA6x/8Qm3YQPXOBxEQw TXuNs+7tXFshlRCpaFDS93xBxjnezkidLJivBCe6FiuXX0lwMlGLfdlK8i1uCkcL5QE9yxhQo R6EsipL8BVaTtuHmPl3dKTWZi9ArZ7ZdsNNkr5JFeCi3ETzUm4AoMCGlE+DwfUJplKKjZgjt4 5RLTKq4nA3yq/hPowLrWvQLG7WmjTs9d3dIy1kN06AuVhalzxGi6hbsMc3pVSATzYjpTZP2OA QoR7pPRXmXtP0aFKlitBPfQ8drPX7rEki8N8ZHvM2A5KH8Fuy3B2+9xwnQx6BCkCIx2khb4rb JkCseMd Subject: Re: ext/gd: support creation of animated GIFs From: cmbecker69@gmx.de ("Christoph M. Becker") Hi! On 10.01.2017 at 20:24, Andrea Faulds wrote: > Christoph M. Becker wrote: > >> On 09.01.2017 at 21:19, Andrea Faulds wrote: >> >>> 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. > > Alright. > >> >>> 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? > > In fairness, I'm not sure. I know animated GIF streaming has been tried > before, though I doubt if it's actually used at all these days. A more > reasonable case might be embedding an animated GIF in other binary data. > But that's a hypothetical. Okay. > What is the actual “safety” gain of not using streams? That you don't > need to use fopen() yourself? (PHP will close files for you.) I'm just > not super convinced there's a need for adding this extra layer. It's not about having to fopen() the stream – in my opinion at least that's a non-brainer. What is a minor issue though, is that either imagegifanimend() closes the stream automatically (what imagepng() and friends are doing), or not (in my opinion the proper solution, but inconsistent). The major issue for me would be the possibility that the user fiddles with the stream between imagegifanimbegin() and imagegifanimend() – in the worst case closing the stream, so imagegifanimend() would fail or had to catch that. Of course, that would be a programmer error, but nonetheless it would have to be documented, and I'm pretty sure that at least some devs would walk into this trap. Anyhow, thanks for the feedback. I'll see how to unify this in a single RFC (probably with secondary voting options). -- Christoph M. Becker