简体   繁体   English

当仅在样式表中指定宽度时,是否可以调整mod_pagespeed图像的大小?

[英]mod_pagespeed image resizing when only width specified in stylesheet – possible?

mod_pagespeed does this nifty image-resizing, but only if "width= and height= attributes on the tag or an inline style= attribute" are set. mod_pagespeed可以进行这种漂亮的图像大小调整,但前提是设置为“标记上的width =和height =属性或内联style =属性”。 This gets a bit problematic if you have eg 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? 那么,有没有办法同时获得mod_pagespeed图像的大小调整能够在样式表中指定图像宽度? The insert_image_dimensions flag to mod_pagespeed isn't really helpful, since I can't specify image height, resulting in oddly stretched images. mod_pagespeed的insert_image_dimensions标志并没有真正的帮助,因为我无法指定图像高度,从而导致图像奇怪地拉伸。

The blog is running Wordpress, so perhaps there's some Wordpress-specific solution. 该博客正在运行Wordpress,因此也许有一些特定于Wordpress的解决方案。

No, there is no support for cascading CSS styles into the page in mod_pagespeed. 不,不支持将CSS样式级联到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. 这是一个非常棘手的重写器,因为按照定义,它需要实现一个完整的级联模型+阻止CSS处理HTML的输出。 That's not to say it's impossible... 并不是说这是不可能的...

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

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