Search code examples
phplaravellaravel-5intervention

make image blur effect with Intervention library in laravel


i'm trying to add blur effect on my image. I'm using laravel 5.2 and Intervention Image 2 library. here's blur method . I did exactly the same in my code but it doesn't do anything(image stays the same). here's code: in my controller where I store input data and image also, I call makeBlur()helper function. image path stores in $path_preview

controller :

// some code ...
makeBlur($path_preview); // <-- looks like /uplodas/image.jpg
// some code ....
$model->path_preview = $path_preview;
$model->save();

here's helper function:

// $image is string (stores the path of file)
function makeBlur($image){
  $path = public_path() . $image; // get image path add public/ in front of it
  $blurredImg = \Image::make($path);
  $blurredImg->blur(45);
}

no errors, just nothing happens. maybe i didn't get the idea how it works


Solution

  • Save the image after you applied the blur

    $blurredImg->blur(45)->save($image);