Re: ext/gd: Deprecate png2wbmp() and jpeg2wbmp()

From: Date: Fri, 14 Oct 2016 08:48:20 +0000
Subject: Re: ext/gd: Deprecate png2wbmp() and jpeg2wbmp()
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-96366@lists.php.net to get a copy of this message
On 14.10.2016 at 00:50, Kalle Sommer Nielsen wrote: > 2016-10-13 23:17 GMT+02:00 Dan Ackroyd <danack@basereality.com>: > >> On 13 October 2016 at 18:03, Christoph M. Becker <cmbecker69@gmx.de> wrote: >> >>> Implementing a fallback in userland would be trivial >> >> You should do that first, and get at least some people to use them, if >> you want them deprecated or removed from PHP. > > I don't think this really matters for these so rarely used functions tbh Indeed it might be hard to find people still converting to WBMP, let alone finding someone who'd be willing to work with a fallback as long as the functions are in ext/gd. Furthermore a fallback might be as simple as: if (!function_exists('png2wbmp')) { function png2wbmp(string $pngname, string $wbmpname, int $dest_height, int $dest_width, int $threshold) { $im = imagecreatefrompng($pngname); $width = imagesx($im); $height = imagesy($im); $tmp = imagecreate($width, $height); imagecopyresized($tmp, $im, 0, 0, 0, 0, $dest_width, $dest_height, $width, $height); return image2wbmp($tmp, $wbmpname, $threshold); } } In my opinion, there's no need for an external library. The crux would be image2wbmp(); if it won't get fixed, it can't be used here. But in this case I'd prefer a more general solution for converting to black and white according to a given threshold. That might be interesting for other formats (e.g. PNG) as well. -- Christoph M. Becker

« previous php.internals (#96366) next »