Php generates images-Can php reduce the image memory size without changing the image proportion?

Source: Internet
Author: User
A thumbnail has been generated for uploading images on a mobile phone. If 120120 is displayed, it will be unclear. If 360360 is generated and 80 KB is generated, is there a way to reduce the image quality without affecting the image proportion, just like uploading images on a mobile phone like ps, a thumbnail has been generated, 120 120 is not displayed clearly, and 360 is generated.360 of customers talk about K more. Is there a way to reduce the image quality without affecting the image proportion, just like ps?

Reply content:

Upload an image on your mobile phone. a thumbnail is generated, which is 120.120 is not displayed clearly, and 360 is generated.360 of customers talk about K more. Is there a way to reduce the image quality without affecting the image proportion, just like ps?

The imagepng function (resource $ image [, string $ filename [, int $ quality [, int $ filters]) is used for png files. The value of $ quality is 0-9.
Use the imagejpeg function for jpg files. The value of $ quality is 0-100.

How does PHP obtain the compression quality of images?

If you use PHP to generate a thumbnail after the client uploads the image, you can adjust the image quality, such as imagepng and imagejpeg. The third parameter is to adjust the quality, come on.
If you want to try again, you can use the browser to compress the file and upload it again.

Use the gd library to set the image quality.

You can use the image $ type method.

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.