Laravel - Ajax crop image before upload using using croppie plugin
https://www.itsolutionstuff.com/post/laravel-5-ajax-crop-image-before-upload-using-using-croppie-pluginexample.html
Last updated
https://www.itsolutionstuff.com/post/laravel-5-ajax-crop-image-before-upload-using-using-croppie-pluginexample.html
Last updated
By Hardik Savani June 24, 2017 Category : PHP Laravel Bootstrap jQuery AjaxPauseUnmuteLoaded: 3.10%FullscreenIn this article i will let you know jquery ajax crop image before upload using croppie plugin in laravel 5, laravel 6, laravel 7, laravel 8 and laravel 9 application.
After several feedback and request from viewer for post of laravel 5 crop image upload example, i decide to find good plugin and post for ajax crop image in laravel 5 application, Last few days ago i already posted for image uploading with laravel like Ajax Image Upload Example With Validation in Laravel, Laravel 5 multiple images uploading using dropzone js example with demo etc. in todays we almost require image upload for profile or product etc. So it would always perfect if you do something best using bootstrap jquery plugin.
In this example we will use croppie plugin for crop image before upload. croppie plugin is perfect fit for profile image upload function. croppie plugin provide circle and square crop photo and several others option for settings.
So, after you followed all step you will get layout as like bellow, so let's follow bellow step and got example:
Layout:
Step 1: Add New Routes
In first step, we will add two new routes in our laravel application. So you have to add "image-crop[GET]" and "image-crop[POST]" routes in web.php file as like bellow:
routes/web.php
Step 2: Create New Controller
In second step we will create new ImageController for two new routes request method. In this controller we will add two method imageCrop() and imageCropPost(). So you have to simply get bellow code and put on your controller:
app/Http/Controllers/ImageController.php
Read Also: Crop, Resize, Frames etc on selected image in php using Aviary
Step 3: Create New View File
In this Last step, we require to create imageCrop.blade.php file and we write code for crop image using croppie plugin. So you have to simply add bellow code on following path:
resources/views/imageCrop.blade.php
After followed successfully you must have to create "upload" folder with full permissions, After that you can quick run by following command:
Now you can open bellow url on your browser:
Read Also: Ajax Image Upload using PHP and jQuery Example from scratch
I hope it can help you...