I\'ve been looking for PHP code to apply a Gaussian blur to images.
What I\'ve done was like this:
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;
Image optimization is very heavy process so personally if i have these kind of task in PHP then i use this PHP Image Library Called PhpThumb it can create blur images without any code you just need to call it's script via url and provide parameters according to its docs check it's demo.
You can use ImageMagic
Original Image
Run via exec
convert a.png -blur 0x3 a_blur.png
OR Run
convert a.png -blur 0x8 a_blur.png