On 14.10.2016 at 00:50, Kalle Sommer Nielsen wrote:

> 2016-10-13 23:17 GMT+02:00 Dan Ackroyd <dan...@basereality.com>:
>
>> On 13 October 2016 at 18:03, Christoph M. Becker <cmbecke...@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

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to