How to Crop And save Image Using Jcrop .js in asp.net
4675
29-Dec-2015
I want to use Crop And save Image Using Jcrop .js in asp.net How to do this please help me.
Aryan Kumar
03-Jul-2023Sure, here are the steps on how to crop and save image using Jcrop.js in ASP.NET:
Here is an example of the code:
HTML
This code will add the Jcrop.js library to your ASP.NET project. The
OnSelectfunction will be called when the user has finished cropping the image. TheOnSelectfunction will save the cropped image to a file.Anonymous User
30-Dec-2015Anonymous User
30-Dec-2015$('#imgUser').load(function () { debugger; $('#userpopup').fadeIn(500); var imgwidth = $('#imgUser').width(); var imgheight = $('#imgUser').height(); var imgval = imgwidth / imgheight; var diagWidth = $("#dialog-cropImage").width(); if (imgval > 1) { var ratio = diagWidth / imgwidth; $('#imgUser').width(imgwidth * ratio); $('#imgUser').height(imgheight * ratio); $('#dialog-cropImage').height((imgheight * ratio)); } else { var ratio = $("#dialog-cropImage").height() / imgheight; $('#imgUser').width(imgwidth * ratio); $('#imgUser').height(imgheight * ratio); $('#dialog-cropImage').css('max-width', (imgwidth * ratio) + 32); } initCrop(this.naturalWidth, this.naturalHeight); });
Anonymous User
30-Dec-2015Anonymous User
29-Dec-2015I am using jcrop for crop image in asp.net . following below code