Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96173 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6827 invoked from network); 28 Sep 2016 08:10:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Sep 2016 08:10:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=mail@felixniklas.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mail@felixniklas.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain felixniklas.de from 85.13.153.236 cause and error) X-PHP-List-Original-Sender: mail@felixniklas.de X-Host-Fingerprint: 85.13.153.236 dd37304.kasserver.com Received: from [85.13.153.236] ([85.13.153.236:58785] helo=dd37304.kasserver.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C4/8F-04248-5DA7BE75 for ; Wed, 28 Sep 2016 04:09:59 -0400 Received: from [172.23.42.106] (ipb-rifu.fuckup.club.berlin.ccc.de [91.102.8.161]) by dd37304.kasserver.com (Postfix) with ESMTPSA id 511F83A0086F for ; Wed, 28 Sep 2016 10:09:55 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.0 \(3226\)) Message-ID: Date: Wed, 28 Sep 2016 10:09:54 +0200 To: internals@lists.php.net X-Mailer: Apple Mail (2.3226) Subject: [RFC] add radius and sigma to IMG_FILTER_GAUSSIAN_BLUR From: mail@felixniklas.de (Felix Niklas) Hey there, this is my first time on here and I want to start out by saying how = thankful I am for your work. Thank you for working on php. Thank you for = pushing this language further. tl;dr: I=E2=80=99d like to add the parameters radius and sigma to the = $filtertype IMG_FILTER_GAUSSIAN_BLUR by switching the underlying libgd = method from (accepts no parameters) to = (accepts these parameters). Recently I wanted to replace a css blur filter with pre-processed images = that get blurred on the server in order to improve the = scroll-performance in the browser. I had to realise that imagefilter=E2=80= =99s IMG_FILTER_GAUSSIAN_BLUR is not suitable for the job. It maps to = . This method lacks the radius and sigma = parameters. Instead it =E2=80=9Cperforms a Gaussian blur of radius 1 on = the image=E2=80=9D [1]. Imagine using a brush to blur an image: radius 1 = is like using a tiny tiny brush. What would you use to blur more = intensely? A big brush. But the option to switch is not there. = SimpleImage.php tries to overcome this by blurring with the tiny brush = over and over [2]. The thing is =E2=80=93 the tiny brush is inevective. = If you want a big blur you need a big brush. And it can be achieved by = binding to instead of = . I think I can write the patch for the method [3]. The added parameters = would have to get checked so I=E2=80=99d have to look into how = works. returns a boolean, = [4] returns a copy of the image instead. If = fails it returns NULL. So the code handling = the return value would have to handle a NULL return instead of an = integer > 0 return. Thoughts? =E2=80=93Felix [1] gd_filter.c = https://github.com/libgd/libgd/blob/master/src/gd_filter.c#L709 [2] SimpleImage.php = https://github.com/claviska/SimpleImage/blob/master/src/abeautifulsite/Sim= pleImage.php#L174 [3] gd.c = https://github.com/php/php-src/blob/master/ext/gd/gd.c#L4392 [4] gd_filter.c = https://github.com/libgd/libgd/blob/master/src/gd_filter.c#L922=