How to achieve a blur effect in PHP?

前端 未结 3 389
误落风尘
误落风尘 2020-12-15 14:31

I\'ve been looking for PHP code to apply a Gaussian blur to images.

What I\'ve done was like this:



        
3条回答
  •  借酒劲吻你
    2020-12-15 15:11

    It is possible also without ImageMagic lib;

    header('Content-Type: image/png');
    
    $blurs = 10;
    $image = imagecreatefrompng('blur.png');
    for ($i = 0; $i < $blurs; $i++) {
        imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);
    }
    imagepng($image, 'blur10.png');
    imagedestroy($image);
    

    After 10 blur applied;

    enter image description here

提交回复
热议问题