0

I use gaussian blur. 1 line of

imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);

doesn't give the desired blur intensity. So I need to use it like 30 times. This is an unprofessional way, it increases the page load time a lot when there are many images on the page. So is there any better/smarter way for image blur ?

  $image = imagecreatefromjpeg("caski_m.jpg");
  imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR);
  header("content-type: image/jpeg");
  imagepng($image);
  imagedestroy($image);
Jibin Balachandran
  • 3,271
  • 1
  • 21
  • 38
user198989
  • 4,414
  • 18
  • 62
  • 93

1 Answers1

1

If you are searching more concise and elegant solution then:

  1. install ImageMagick extension for php
  2. use php exec command to invoke ImageMagick convert operator:

Schema: exec("convert <your_image_name> -blur <blur_level> <your_blured_image_name> ");
You can adjust blur level flexibly.
Example: exec("convert '$image' -blur 0x8 'blur_' . $image");
But don't forget to specify accesible image path.
To get more options look at the following: imagick_blur_guide

RomanPerekhrest
  • 75,918
  • 4
  • 51
  • 91