PNG图像的奇怪的pagepeed URL? [英] Weird pagespeed URL for PNG image?

查看:193
本文介绍了PNG图像的奇怪的pagepeed URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上传了一个带有Alpha透明度的PNG图片到文件名为logo.png的服务器,但是当图片在页面上使用时,我会看到它的文件路径:

  http://example.com/i/300x300xlogo.png.pagespeed.ic.0A66xVq4G9.png 



该文件无法在服务器上看到。



我不知道它会影响它,但实际图像大小是400px乘400px,我在HTML中显示为300px乘300px。 (不要问。)



这可能是我的网络主机这样做吗?似乎在文件前面的解析度显示在 300x300x ,还有一个奇怪的后缀: .pagespeed.ic.0A66xVq4G9.png

解决方案

您看到的网址符合预期:mod_pagespeed将图片网址重写为优化名称,将大小以及内容的指纹嵌入文件名中。



如果您要将HTML中的图像从原始大小缩小..您正在浪费用户的带宽,这在移动上是特别痛苦的。 mod_pagespeed的优点是,它可以在飞行中为你调整大小 - 只需在HTML中指定所需的维度,它会做正确的事情。



有关mod_pagespeed执行的各种图像优化的更多信息,请参阅:
https: //developers.google.com/speed/docs/mod_pagespeed/filter-image-optimize



您称为加载速度较慢的效果听起来像image lazyload:
https://developers.google。 com / speed / docs / mod_pagespeed / filter-lazyload-images



图片会延迟到onload启动,这有助于快速将页面绘制到屏幕。您还可以配置mod_pagespeed来执行此滚动,以便只加载可见图像。最后,您还可以禁用此特定过滤器,但保持上面的图像优化。



mod_pagespeed不再是测试版,该小组最近发布了1.0。


I uploaded a PNG image with alpha transparency to my server with the filename logo.png, however, when the image is used on a page and I go to see it's file-path, I get:

http://example.com/i/300x300xlogo.png.pagespeed.ic.0A66xVq4G9.png

That file is nowhere to be seen on the server.

I don't know if it affects it, but the actual image size is 400px by 400px, and I have it displayed in the HTML as 300px by 300px. (Don't ask.)

Could it be my web-host doing this? Seems to prefix the file with the resolution to be displayed at: 300x300x and also has that weird suffix: .pagespeed.ic.0A66xVq4G9.png

解决方案

The URL you're seeing is as intended: mod_pagespeed rewrites the image URL to an optimized name and embeds the size, as well as the fingerprint of the content into the filename.

If you're downscaling the image in HTML from the original size.. you're wasting user's bandwidth, which is especially painful on mobile. Advantage of mod_pagespeed is that it can do this resizing for you on the fly - simply specify the desired dimensions in the HTML and it will do the right thing.

You can read more about the various image optimizations done by mod_pagespeed here: https://developers.google.com/speed/docs/mod_pagespeed/filter-image-optimize

What you're describing as "loading slower" sounds like "image lazyload": https://developers.google.com/speed/docs/mod_pagespeed/filter-lazyload-images

The images are deferred until onload fires, which helps get the page painted faster to the screen. You can also configure mod_pagespeed to do this on-scroll, such that only visible images are loaded. Finally, you can also disable this specific filter, but keep the image optimization done above.

P.S. mod_pagespeed is no longer beta, the team recently shipped 1.0.

这篇关于PNG图像的奇怪的pagepeed URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆