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

Stevan
Stevan
48 Points
24 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: 81
Total Answered: 1
Total Marked As Answer: 0
Posted On: 03-Jul-2021 23:38

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
1280 Points
225 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