Php image processing problems php image proportion when processing images there is a problem I have never understood is that the original image has a aspect ratio and the target image also has a aspect ratio why the aspect ratio of the source image is greater than that of the target image height-to-height ratio first $ ratio = ($ this-& gt; width)/($ this-& gt; height); // ratio of the actual image $ res php image processing problems
When processing php images or other proportions, the problem persists: the source image has a aspect ratio and the target image has a aspect ratio. why is the aspect ratio of the source image greater than the aspect ratio of the target image? high priority
$ Ratio = ($ this-> width)/($ this-> height); // ratio of the actual image
$ Resize_ratio = ($ this-> resize_width)/($ this-> resize_height); // ratio of the changed image
If ($ ratio> $ resize_ratio ){
High priority // I don't understand why this is high priority
} Else {
Width first // do not understand why width first
}
Private $ width; // The actual width.
Private $ height; // actual height
Private $ resize_width; // The modified width.
Private $ resize_height; // The height after the change
------ Solution --------------------
This does not have certain rules. it depends entirely on the needs of the original author. You can reverse it as needed
In proportional scaling, you only need to specify the target image width (if you want to get the same width as the target image) or the target image height (if you want to get the same height as the target image)
Images of the same width or height are displayed on the page.
Your class needs to provide the width and height of the target image, and then calculate the width and height of the target image through the aspect ratio. it seems intelligent and actually becomes troublesome.
If you scale the heads of #1 and #2, you will know.
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.