The cornerstone of the image transformations is the IImageProcessor interface and its default implementation ImageProcessor.
IImageProcessor
ImageProcessor
This interface describes the available processing operations that could be used in Sitefinity CMS. It contains two methods - Resize and ProcessImage that should be implemented in order the Sitefinity CMS backend to operate smoothly.
Resize
ProcessImage
This class represents the default implementation of IImageProcessor interface and it is registered in ObjectFactory (IoC) Container and can be changed with other one. It has 3 image processing methods. They are described below with their arguments.
FitToAreaArguments
Resizes the specified source image by changing one of the sides (width or height) to the desired size and the other side proportionally (keeping the ratio). FitToSideArguments class is used to define the Resize method argument for specifying the desired resize options.
FitToSideArguments
It resizes the side with smaller change keeping the ratio width/height and cuts the other side from both sides (to preserve the center of the image) to satisfy the desired width and height. CropArguments class is used to define the Crop method argument for specifying the desired cropping options.
CropArguments
You should mark each processing method with Attributes that provide additional information in order to be used by Sitefinity CMS successfully. Below are the different types responsible for the image processing metadata.
This class encapsulates the meta-data about image processing method. It holds information about method arguments and gives the ability to create new instance of the argument object, to parse and serialize, validate from/to string the image processing parameters.
Defines the metadata for the particular property used as a parameter for the image processing method.
This attribute marks the image processing methods that can be used in Sitefinity CMS. If you extend the ImageProcessor class you must mark your custom image processing methods with this attribute. All methods like this will be discovered and exposed automatically for thumbnail generation.
This attribute specifies the image processing argument for the transformation method. Each property that should be passed as argument to the processing method should be marked with this attribute.
When the image processing fails for some reason there are types that store the information about the error.
Represents the exception that is thrown when the image processing fails. It contains the processing error information.
This enumeration contains the specific reason for the image processing error. There are two reasons specified: MethodNotFound - The generation method could not be found. MethodGenerationError - Internal image processing error. The method for generation is executed and throws an error.
MethodNotFound
MethodGenerationError
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important