Search Results for

    Show / Hide Table of Contents

    Image

    The Image class is used when you want to have an image conversion for the media. Depending on which converters are installed, not all media can be converted to images (like documents). If that's the case use the thumbnail instead.

    Resize

    To resize the media, use the Resize method.

            var client = ClientFactory.GetSdkClient();
            var image = client.Load<Image>(1223)
    .Resize(120, 120, ResizeMode.ScaleToFill).SingleOrDefault();
    

    The method takes three arguments:

    width: The width of the resized media

    height (optional): The height of the resized media

    resizeMode (optional): In which way to resize the media. There are two alternatives:

    ScaleToFit - Scales the media to fit inside the specified width and height, aspect ratio is kept. This is the default.

    ScaleToFill - Scales the media to fill the specified width and height, aspect ratio is kept by cropping if necessary.

    Note! ScaleToFill requires both width and height to be set.

    Crop

    To crop the media, use the Crop method.

             var client = ClientFactory.GetSdkClient();
             var image = client.Load<Image>(223).Crop(10, 20, 50, 50).FirstOrDefault();
    if (image != null) {
    	var html = string.Format("<img url=\"{0}\" width=\"{1}\" height=\"{2}\"/>", image.Url, image.Width,
    							 image.Height);
    }
    

    The method takes four arguments:

    X: The left coordinate where the crop starts

    Y: The top coordinate where the crop starts

    Width: The width of the crop area

    Height: The height of the crop area

    In This Article
    Back to top (c) Meriworks 2002-2022