Laravel 5.8 Image Resize Tutorials

Today, We want to share with you Laravel 5.8 Image Resize Tutorials.In this post we will show you PHP Laravel 5.8 Intervention image upload and resize tutorial, hear for Upload and Resize Multiple Images in Laravel 5.8 we will give you demo and example for implement.In this post, we will learn about Resize Images in Laravel 5.8 with Spatie Media Library with an example.

Laravel 5.8 Image Resize Tutorials

There are the Following The simple About Laravel 5.8 Image Resize Tutorials Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Image Resize and Upload Tutorial With Example, so the laravel intervention image upload for this example is following below.

Step 1: Laravel 5.8 Installation

configure with Installation intervention/image library

composer require intervention/image

config/app.php Update (service provider && aliases )

'Intervention\Image\ImageServiceProvider'
'Image' => 'Intervention\Image\Facades\Image'

Step 2: Define Laravel 5.8 Route

app/Http/routes.php

    Route::get('intervention-resizeImage',['as'=>'intervention.getimgmanipulation','uses'=>'ImgManipulationController@getResizeImage']);
    Route::post('intervention-resizeImage',['as'=>'intervention.uploadedimagesresize','uses'=>'ImgManipulationController@uploadedimagesresize']);
	

Step 3: Update Laravel 5.8 Controller

app/Http/Controllers/ImgManipulationController.php

    validate($request, [
                'photo' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:1024',
            ]);
            $photo = $request->file('photo');
            $new_file_name = time().'.'.$photo->getClientOriginalExtension(); 
       
            $finalUploadedPath = public_path('/upload_media_img');
            $thumb_img = Image::make($photo->getRealPath())->resize(100, 100);
            $thumb_img->save($finalUploadedPath.'/'.$new_file_name,80);
                        
            $finalUploadedPath = public_path('/profiles');
            $photo->move($finalUploadedPath, $new_file_name);
            return back()
                ->with('success','Good Luck, Your Image Upload successful')
                ->with('new_file_name',$new_file_name);
        }
    }

Step 4: Create Laravel Blade file

resources/views/files/imgmanipulation.blade.php

    @extends('layouts.default')
    @section('content')
    
Laravel 5.8 Intervention upload image after resize Example - step by step
@if (count($errors) > 0)
@foreach ($errors->all() as $error)

{{ $error }}

@endforeach
@endif @if (Session::get('success'))
Image Before Resize:
Laravel 5.8 Image Resize
Image after Resize:
Laravel 5.8 Image Resize
@endif {!! Form::open(array('route' => 'intervention.uploadedimagesresize','files'=>true)) !!}

{!! Form::file('photo', array('class' => 'form-control')) !!}

{!! Form::close() !!}
@endsection
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.8 Image Resize Tutorials.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment