|
Standard ASP.NET image controls contain an attribute called ImageUrl enabling a single image source to be provided.
51Degrees.mobi allows multiple image sources to be provided to all image controls using a collection. The following code example shows how multiple image sources are provided.
ASP.NET
<mob:Image runat="server" ID="ImageFlower" ImageUrl="~/Images/PurpleFlower.jpg" CalculateSizeMode="ClientWidth">
<mob:AltImage ImageUrl="~/Images/PurpleFlower_480.jpg" />
<mob:AltImage ImageUrl="~/Images/PurpleFlower_360.jpg" />
<mob:AltImage ImageUrl="~/Images/PurpleFlower_200.jpg" />
<mob:AltImage ImageUrl="~/Images/PurpleFlower_120.jpg" />
</mob:Image>
At runtime the server will work with the browser to determine the size of image needed. The closest match is then chosen from the collection provided. It is then shrunk to meet the precise dimensions required.
This approach enables designers to retain complete control, whilst optimising their design for performance. Read the Images chapter from the Developers guide to find out more about 51Degrees.mobi image controls and additional features.
|