mod_pagespeed does this nifty image-resizing, but only if "width= and height= attributes on the tag or an inline style= attribute" are set. This gets a bit problematic if you have e.g. an image blog with hundreds of posts and one day in the future might want to change the stylesheet, resulting in a new width for images.

So, is there a way to get both mod_pagespeed image-resizing and be able to specify the image width in a stylesheet? The insert_image_dimensions flag to mod_pagespeed isn't really helpful, since I can't specify image height, resulting in oddly stretched images.

The blog is running Wordpress, so perhaps there's some Wordpress-specific solution.

有帮助吗?

解决方案

No, there is no support for cascading CSS styles into the page in mod_pagespeed. This is a really tricky rewriter to implement, since by definition it would require implementing a full cascade model + block the output of HTML on CSS processing. That's not to say it's impossible...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top