简体   繁体   English

用PHP压缩图像

[英]Compress images with PHP

I process uploaded images by php to save (after resize) by imagejpeg . 我通过php处理上传的图片,以通过imagejpeg保存(调整大小后)。 As I explored, imagejpeg is the best php command to compress jpg images to reduce the file size. 正如我所探索的那样, imagejpeg是压缩jpg图像以减小文件大小的最佳php命令。 However, when I check my website by Google Page Speed, it says all of my images can be compressed 4-10%. 但是,当我通过Google Page Speed检查我的网站时,它说我的所有图像都可以压缩4-10%。

What is the common method to compress images to meet the Google standard? 压缩图像以满足Google标准的常用方法是什么?

Googles "standard" is the possible maximum to be expected by google. Google的“标准”是google可能期望的最大值。 You need to use highly optimized image compressors that does nothing else than image compressing and therefore get a possible maximum best value here. 您需要使用高度优化的图像压缩器,除了图像压缩外别无其他选择,因此这里可能会获得最大的最佳值。

You can for example, open you jpeg file in a image editor like adobe photoshop and create the possible maximum best compression to be expected by you while having visual control. 例如,您可以在诸如Adobe Photoshop之类的图像编辑器中打开jpeg文件,并在进行视觉控制的同时创建可能期望的最大最佳压缩率。 Highly recommended. 强烈推荐。

The GD library provides a standard conform jpeg compression which should match a library users expectation, but which might not satisfy a graphic designer (and/or google by 4-10%). GD库提供了一个标准的JPEG压缩格式,该压缩应符合库用户的期望,但可能无法满足图形设计师的要求(和/或Google满足4-10%)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM