How to compress the image size in php

Source: Internet
Author: User
Php: how to compress the image size first, let's talk about our website. after the website is written in the background, the editors upload images as needed. many images are saved in the png format by default by QQ. The code for uploading images is written by a colleague who uses ueditor and does not control the upload size. my colleague resigned last week and handed over his work to me. In the morning, O & M told me that our website occupies too much bandwidth. The reason is that the picture is too large.

Enter the subject:

For uploaded images, how to compress the images, or when a request is made, the images returned by http are smaller. The size of the png images uploaded by colleagues Is KB, and the boss requires that the images be smaller than 50 kB. What I can do now is to control the image size during upload. It is impossible to change the uploaded files one by one. it is too time-consuming.


Reply to discussion (solution)

Now it's just a few megabytes on your phone... Which has 50 k...

According to the information disclosed by lz, the company where lz is located may be a broken company:
1: The employee unexpectedly chooses to resign at the end of this year. the normal departure time is in the first few months of the next year, so there will be a year-end bonus, however, lz's colleagues leave in this time period, and are very dissatisfied with their work. All companies that allow employees to leave their jobs during this period are certainly not very good.
2: The boss of the company where lz is located has invited a 50 k ticket. isn't that a nonsense? Do I need to pay more for bandwidth? It can be seen that this boss is definitely a growth ratio. how can a boss with a growth ratio have a good company.

Therefore, I hope that I can leave the company after cooking and find a better destination.

Well, you can download the website to your local computer and then use the software that compresses images in batches.
Download the image lossless compression master

PS has batch processing

You have written a batch processing program. for details, refer.
Search for image files (jpg, gif, and png) in directories and subdirectories, and compress images larger than a certain value.
Http://blog.csdn.net/fdipzone/article/details/39651709

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.