PHP Crop Resize Image while Uploading using jquery plugin

Today, We want to share with you PHP Crop Resize Image while Uploading using jquery plugin.
In this post we will show you Crop Image and upload with php, hear for PHP jQuery crop and resize image before upload using croppie plugin we will give you demo and example for implement.
In this post, we will learn about Upload and Crop Image using PHP and jQuery with an example.

PHP Crop Resize Image while Uploading using jquery plugin

There are the Following The simple About PHP Crop Resize Image while Uploading using jquery plugin Full Information With Example and source code.

first of all You have to make simple two PHP file as well as one simple upload folder for Save all the crop your image like as bellow listed:php image upload and resize

  • index.php
  • Crop_Image_upload.php .php
  • upload(Directory)

php upload profile picture crop

index.php





Profile Upluad
Select Profile:
$uploadCrop = $('#Profile-demo').croppie({ enableExif: true, viewport: { width: 300, height: 300, type: 'circle' }, boundary: { width: 400, height: 400 } }); $('#profileupload').on('change', function () { var readerData = new FileReader(); readerData.onload = function (e) { $uploadCrop.croppie('bind', { url: e.target.result }).then(function(){ console.log('Good Luck jQuery bind complete'); }); } readerData.readAsDataURL(this.files[0]); }); $('.profile-upload-result').on('click', function (ev) { $uploadCrop.croppie('result', { type: 'canvas', size: 'viewport' }).then(function (results) { $.ajax({ url: "/Crop_Image_upload.php .php", type: "POST", data: {"image":results}, success: function (data) { html = 'PHP Crop Resize Image'; $("#Profile-demo-i").html(html); } }); }); });

Crop Image and upload with php Scripts

Crop_Image_upload.php .php

$contentData = $_POST['image'];
list($type, $contentData) = explode(';', $contentData);
list(, $contentData) = explode(',', $contentData);
$contentData = base64_decode($contentData);
$profileName = time().'.png';
file_put_contents('media/'.$profileName, $contentData);
echo 'done';

We can help To you More Information For crop image while uploading with jquerycroppie.js Plugin

PHP Crop Resize Image while Uploading using jquery
PHP Crop Resize Image while Uploading using jquery

Read :

Summary

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

I hope you get an idea about Live Image Upload, Crop and Resize using jQuery and PHP.
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