Managing responsive images
Kentico provides support for responsive images management. The responsive images functionality enables you to create your own image filters and combine them in different ways to create image variants. For example, you can define image variants based on various criteria such as screen size, the type of the target device, and so on.
Each filter and image variant definition is represented by a standard .NET class that needs to be implemented by a developer. Note that image variants can be generated only for images stored as page attachments.
To use responsive images in Kentico, you need to:
- Add filters that can be applied on images.
- Define filters that represent actions such as crop, resize, watermark, etc.
- Define image variants.
- Use the created filters and develop image variant definitions to fit your needs.
- Generate image variants.
- Imagevariants are automatically created only for newly uploaded and updated page attachments.
- For existing page attachments, you need to generate image variants manually.
- Use image variants on your pages.
- Display image variants on your pages by using macro methods and ASCX transformations.
- For displaying image variants on MVC sites, see Working with page attachments in MVC applications.
Sample code files
By default, the Kentico project contains sample implementations of filters and image variant definitions that are applied only on the Dancing Goat demo site. If you do not need the samples, you can safely remove the following folder from your project:
- Web site project: ~/CMS/App_Code/Demo/ResponsiveImages
- Web application project: ~/CMS/Old_App_Code/Demo/ResponsiveImages