Only resize images upon every request in debug mode (see #6211)