temp_name
temp_name

Reputation: 1

Laravel adding blur to a picture in storage

I am saving the image in the store. Here I need to make a blurred version of the image.

$path = $request->file('file-upload-photo-profile')->store('public/profile');
        $user->photo_profile_url = 'storage/app/'.$path;
        $user->photo_profile = $path;
        /*
         * теперь блур
         * */
        $url=url('/').'/'.$user->photo_profile_url;
        $image=imagecreatefromjpeg($url);
        $imagick = new Imagick($image);
        $imagick->blurImage(5, 5);
         $imagick->getImageBlob();

        Storage::put('dssds.jpg',$imagick);

But the resulting file cannot be opened. This is not a picture.

Upvotes: 0

Views: 602

Answers (1)

Mohammad Mirsafaei
Mohammad Mirsafaei

Reputation: 964

I think this url (photo_profile_url) that you're reading image from leads to 404 page cause your using laravel's url() function with internal path of storage. If you want to load an image from url, pass image's public url to Imagick.

Upvotes: 1

Related Questions