Check out the latest documentation.

Image Optimisation

This element specifies image optimiser parameters.

Attribute Mandatory Description
enabled No Controls whether image optimisation is enabled. Defaults to true. Device detection must also be enabled for image optimisation.
factor No The request image dimensions of height and width are divided by this value and remainder subtracted from the requests height and width. The value can be used to limit the number of images that can be generated and stored in the cache. For example; a value of 50 would result in images of width 50, 100, 150, 250, 300, etc pixels being generated. Defaults to 1.
heightParam No The name used when specifying the height of the image to return. Defaults to 'height'.
maxHeight No The maximum height in pixels the image optimiser is allowed to render. A value of 0 indicates there is no maximum height. Defaults to 0.
maxWidth No The maximum width in pixels the image optimiser is allowed to render. A value of 0 indicates there is no maximum width. Defaults to 0.
widthParam No The name used when specifying the width of the image to return. Defaults to 'width'.

The following XML provides an example of the configuration element.

								<imageOptimisation maxWidth="1000" maxHeight="1000" factor="1" widthParam="w" heightParam="h"/>

								

web.config Changes

To ensure image optimisation works with images served by the same web server as the web site the 51Degrees module must be configured to handle requests from unmanaged code and the precondition attribute should not be present where the module is defined. The following shows the correct module registration.

								<modules>
  <add name="Detector" type="FiftyOne.Foundation.Mobile.Detection.DetectorModule, FiftyOne.Foundation"/>
</modules>

								

A simple method to test image optimiser is working server side is to request the image at it's standard size using it's URL. For example the logo for this site would be:

http://51degrees.com/Portals/0/Logo.png

Then append the required with to the URL and verify that a different sized image is returned. Modifying the previous example for 100 pixels wide would result in a URL like the following.

http://51degrees.com/Portals/0/Logo.png?width=100