skileton skileton - 3 years ago 233
PHP Question

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

Answer Source

Save the image after you applied the blur

$blurredImg->blur(45)->save($image);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download