2

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.

unhammer
  • 4,306
  • 2
  • 39
  • 52

1 Answers1

4

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...

igrigorik
  • 9,433
  • 2
  • 29
  • 30
  • 1
    OK, guess I should rephrase my problem in terms of making wordpress add correct image dimensions to the post html on-the-fly. The width is the same everywhere, so I guess php should be able to figure out the height (or width/height ratio) on-the-fly (and cache the result of course, I have a feeling that kind of info is slow to look up). – unhammer Nov 30 '12 at 08:04