Image Compression-php static file server, how to optimize image output?

Source: Internet
Author: User
Now, the company has a project that allows users to upload images and view images, which is similar to Baidu cloud. Then I have a requirement to view the thumbnail first, click the source image to view the source image. I can see that Weibo has this function, and I want to know how they do this function, is uploaded directly... now, the company has a project that allows users to upload images and view images, which is similar to Baidu cloud. Then I have a requirement to view the thumbnail first, click the source image to view the source image. I can see that Weibo has this function, and I want to know how they do this function, how many versions of images are directly compressed during upload, or are images temporarily compressed only when the front-end is loaded?

I want a static server to automatically compress images when outputting images, as qiniu mentioned in the following article does not have the same functionality as qiniu, you only need to simply compress the image according to the proportion of the image, but the compression is better. I have used some compression to compress the image. the sharpness of the pressed image is particularly high and the image is quite real.

I read this article about Web performance optimization: Image optimization, and I think it is helpful. The Google PageSpeed he mentioned can be deployed on the Apache server and will be automatically compressed when obtaining images, it seems suitable. But I searched and found that this is only a tool for detecting server performance, not for compressing images?

Reply content:

Now, the company has a project that allows users to upload images and view images, which is similar to Baidu cloud. Then I have a requirement to view the thumbnail first, click the source image to view the source image. I can see that Weibo has this function, and I want to know how they do this function, how many versions of images are directly compressed during upload, or are images temporarily compressed only when the front-end is loaded?

I want a static server to automatically compress images when outputting images, as qiniu mentioned in the following article does not have the same functionality as qiniu, you only need to simply compress the image according to the proportion of the image, but the compression is better. I have used some compression to compress the image. the sharpness of the pressed image is particularly high and the image is quite real.

I read this article about Web performance optimization: Image optimization, and I think it is helpful. The Google PageSpeed he mentioned can be deployed on the Apache server and will be automatically compressed when obtaining images, it seems suitable. But I searched and found that this is only a tool for detecting server performance, not for compressing images?

A large number of images are directly compressed into several versions when being uploaded (by compressing queue tasks to prevent excessive resource occupation)
There are a lot of compression Implementation Solutions, a bunch of github

Do not use PHP for static files. Use nginx for static files.
For image cropping, nginx has plug-ins that can be used as a c-language plug-in. The speed is definitely better than PHP.

You can use php to dynamically generate thumbnails only once the access is generated and then use static files. This nginx can be configured.
As for image quality, the php ecosystem mainly relies on the expansion of gd imagick. The latter generally says that the quality is relatively good. The sharpness problem should be caused by unreasonable parameters in the call library. We suggest you calm down and try again.

Is it possible to compress the file directly during upload, store a thumbnail, and call the thumbnail directly during display? When you click the mouse, you can directly release the address of the large image to solve the problem. You do not need to store the database locally according to certain rules. It can be assembled when obtained.
I 'd like to know you about QQ: 810978593

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.