PHP Picture Processing problems
PHP pictures, such as proportional processing of the picture when there is a problem has not been understood is the original picture has a aspect ratio of the target picture also has a aspect ratio why the original width and height ratio is greater than the target image of the aspect ratio to high priority
$ratio = ($this->width)/($this->height); Ratio of actual images
$resize _ratio = ($this->resize_width)/($this->resize_height);//ratio of altered images
if ($ratio > $resize _ratio) {
High priority//Just don't understand why this is a high priority
}else{
Width First//Don't understand why width first
}
private $width;//Actual width
private $height;//Actual height
Private $resize _width;//width after change
Private $resize _height;//Height after change
------Solution--------------------
This does not have a certain rule, it depends entirely on the needs of the original author. You can reverse it if you want.
When scaling, just give the target image width (if you want to get the same wide target picture) or the target picture high (if you want to get the same high target picture)
Pictures with the same width or height are arranged 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 by the aspect ratio, which seems to be very smart, actually becomes troublesome.
If you zoom in on #1 and #2 avatar, you'll 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.