How to crop an image based on four coordinates?-php Tutorial

Source: Internet
Author: User
How to select the cropping area based on the four coordinate cropping methods for the image? four coordinate parameters are generated based on the juqery Image Plugin? X155&y117&x2420&y2265&fileimages1600x0000.jpg based on the four coordinate parameters, crop the original 600*1200 image in the specified area. how is the coordinate ratio calculated? For example, if the x1 coordinate is 55, the image is not cropped according to the four coordinates.


Selected crop area

Generate four coordinate parameters based on juqery image plug-in

? X1 = 55 & y1 = 17 & x2 = 420 & y2 = 265 & file = images/1600x0000.jpg

Based on the four coordinate parameters, crop the image of the original 600*1200 in the specified selection area

How is the coordinate ratio calculated? For example, if the x1 coordinate is 55, it does not mean that the x axis starts from 55 ..

In addition, how can we calculate the image size to be cropped as 1269*1033 based on the four coordinates?

How can I use the imagecopyresampled processing functions of these GD libraries? Please advise! 3Q

------ Solution --------------------
You should give the source of the tutorial
------ Solution --------------------
You need to know the parameters 1, 2, and 3.
1. the height and width of the image for cropping (the actual value of stretching/scaling)
2. the starting coordinate of the cropping frame and its length and width
3. the height and width of the image you want to generate
3. based on the zoom level, calculate the actual starting point coordinates of the source image to be cropped and the actual length and width of the cropped area in the source image.
4. use the imagecopyresampled function to get the image you need. Read the manual for parameters.

------ Solution --------------------
OK. The starting coordinates and width and height are determined if they are rectangles.

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.