Jquery-Image Upload and cropping plug-in-imgareaselect (Analysis 3) how to obtain the image information of the selected domain

Source: Internet
Author: User

Let's analyze it first:

(The following values, how to obtain them, and then analyze them in the specific implementation. Now we will only talk about macro-level values)

How do I obtain the image information of the selected domain?In fact, how do we obtain the selected area, the position in the image, and the size of this area?

Tell the computer the location and size, and it will know that we are going to get the image information.

(Our selection area is in a plane and is a regular image, square, or both rectangular (common: rectangle ))

Size:

The width and height of the area. The two values are multiplied by the area, that is, the size of the area. (This should not be difficult)

Location:

1. if we only tell the computer that the selected region has a [coordinate value of the starting point] and the computer's [area], there are four conditions that match the two conditions:

"Red" indicates the starting point coordinate of the selected region;

A, B, C, and D are the selected regions starting from red (the area of each region is the same, and the coordinates of the start point are the same, but four situations can be found );

 

1. Suppose we tell the computer that the two coordinate values of the selected region also tell the computer area:

"Red" indicates the starting point coordinate of the selected region,

"Blue" is the coordinate value of the horizontal end point of the selected area.

"Green" indicates the area of the selected area;

Only one of the three conditions must be met.

 

 

Therefore, we need to obtain the region information of this image.

The preceding three values: Two-Point coordinate value and one area value.

$ ('# X1'). Val (selection. X1 );
$ ('# Y1'). Val (selection. Y1 );
$ ('# X2'). Val (selection. x2 );
$ ('# Y2'). Val (selection. Y2 );
$ ('# W'). Val (selection. width );
$ ('# H'). Val (selection. Height );

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.