Exforsys.com
 
Home Tutorials ASP.NET 2.0
 

ASP.NET : Dynamic Image control

 

ASP.NET Training : Dynamic Image control

In this tutorial you will learn how to create Dynamic Image Control, DynamicImage Control Properties and Custom Parameters.



The DynamicImage control derives from the DynamicImageBase which is in turn derived from Image. This control acquires image bytes from varied sources and renders them to image capable devices using an internal normalization process. It stores the images in the System.Drawing.Image object and is cached in ASP.NET Cache with a randomly generated key. The HTML generates a < img > tag. The CachedImageService.axd URL is a built in HTTP handler which retrieves the image from the cache object and serializes its bytes to the browser using the proper content type. The data parameter of the Query handler string is used to select the image. The ImageUrl property can be used to find the URL of the image. The DynamicImage has the following properties.


  • ID - ID of the server control
    .
  • ImageGeneratorURL- The URL of our ImageGenerator .asix file which will build our image on the fly
    .
  • ImageType - Automatic, Jpg, Gif, Bmp, Png
    .
  • Height - Height of the image
    .
  • Width- Width of the image
    .
  • ParameterMode - ImageGenerationStorage (more secure) or QueryString
    .
  • ForeColor - The font color of the text
    .
  • BackColor - The back ground color of the image (only displays if a background image isn't supplied)
    .
  • Image –an object of the System.Drawing.Image. It gets and sets the property of the image.

Custom Parameters

  • Text - The text that should be displayed
    .
  • Font - The font of the text
    .
  • FontSize - Size of the text
    .
  • FontStyle - Style of the font
    .
  • xPoint - Where the text should be located along the X axis (0 is left most)
    .
  • yPoint - Where the text should be located along the Y axis (0 is top most)
    .
  • Image - Name of the image file that should be used as the background

The DesktopScaling property refers to resizing of the image on the desktop while MobileScaling refers to scaling the image on the mobile devices.


The DynamicImage control links to databases and to xml files. Images can also be dynamically generated using this control. The custom Image Generation Service can also be used. A file with the extension .asix is defined for the image generation services. Image generation handlers are defined at runtime and cached in server memory. The image generator takes a string and creates an image that represents it. Custom image generators can also be created by inheriting from ImageGenerator and overriding the RenderImage method. The image is referenced using the ImageGeneratorUrl property pointing to the ASIX handler. The image object can be received as a QueryString collection or the Parameters collection. This can be defined programmatically using the name/value interface.


In the next sections of this tutorial we shall examine the advanced site functionalities that have been built into ASP.NET 2.0.



Read Next: Advanced Site Functionality - ASP.NET 2.0



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape