简体   繁体   English

WordPress-页面见解-优化移动图像

[英]Wordpress - page insights- Optimize images for mobile

I'm getting a "Compressing and resizing ..." notification at google page insights. 我在Google页面见解中收到“正在压缩和调整大小...”的通知。 I'm well aware of compressing in photoshop, the thing is mobile images seems to need more compressing than the ones on desktop. 我很清楚在photoshop中进行压缩,但事实是,移动图像似乎需要比台式机进行更多的压缩。 1. is there a way to display different images for mobile? 1.有没有一种方法可以显示不同的手机图像? or is there another way to solve this? 还是有另一种方法来解决这个问题? 2. I've tried smush it plugin, doesn't seem to work 2.我试过将其插件弄脏,似乎无法正常工作

There's a new plugin called ricg-responsive-images (which has the backing of the Responsive Images Group – they've been working on getting support for responsive images into browsers). 有一个名为ricg-sensitive-images的新插件(它得到了Responsive Images Group的支持–他们一直在努力为浏览器提供对响应图像的支持)。

It automatically adds a srcset attribute whenever you insert an image in a post, based on the sizes of the image thumbnails you already have (you can customize them in Settings > Media.) 每当您在帖子中插入图像时,它都会根据现有缩略图的大小自动添加srcset属性(您可以在“设置”>“媒体”中对其进行自定义)。

Srcset means that the browser will choose the correct image according to the height, width or pixel resolution of the screen, (hopefully) download the smallest suitable file and without requiring any javascript. Srcset意味着浏览器将根据屏幕的高度,宽度或像素分辨率选择正确的图像,(希望)下载最小的合适文件,而无需任何JavaScript。

The plugin also has commands to generate srcset (or entire image tags) for any image in the media library, which you can use within a theme. 该插件还具有用于为媒体库中的任何图像生成srcset(或整个图像标签)的命令 ,您可以在主题中使用它。

Anecdotally, I've found even if you do manually compress an image you'll usually still get a warning from Google and similar sites that it can be compressed a bit more. 有趣的是,即使您手动压缩图像,通常也会收到Google和类似网站的警告,提示您可以对其进行更多压缩。 Use your judgement as to when it's safe to ignore this. 根据您的判断,何时可以安全地忽略这一点。

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

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