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

StackOverflow https://stackoverflow.com/questions/13632354

  •  03-12-2021
  •  | 
  •  

سؤال

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