How to crop/resize image to fit all the aspect ratio using jCrop?

Stevan
Stevan
312 Points
20 Posts

I'm using following code to load jcrop as:

$('#cropImage').Jcrop({
                    setSelect: [selectX, selectY, selectW, selectH],
                    aspectRatio: 1,
                    minSize: [selectW, selectH],
                    maxSize: [selectW * 4, selectH * 4],
                    handles: true,
                    boxWidth: scalex,
                    boxHeight: scaley,
                    onSelect: storeCoords
                });

Now, it's showing selection as aspect ratio 1:1. I want to we can select any area or free selection style.

 

Views: 1140
Total Answered: 1
Total Marked As Answer: 1
Posted On: 03-Jul-2021 23:38

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
4916 Points
27 Posts
         

It does not need to set aspectRatio. And doing this we can select in any ratio:

$('#cropImage').Jcrop({
                    setSelect: [selectX, selectY, selectW, selectH],
                    minSize: [selectW, selectH],
                    maxSize: [selectW * 4, selectH * 4],
                    handles: true,
                    boxWidth: scalex,
                    boxHeight: scaley,
                    onSelect: storeCoords
                });

 

Posted On: 04-Jul-2021 20:42
 Log In to Chat