Search Results for

    Show / Hide Table of Contents

    Thumbnail

    The Thumbnail class is used when you want to have an image thumbnail for the media, regardless of what type the media is. If the media can not be converted to an image, a icon representing the file type will be returned.

    Resize

    To resize the media, use the Resize method.

            var client = ClientFactory.GetSdkClient();
            var thumbnail = client.Load<Thumbnail>(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 thumbnail = client.Load<Thumbnail>(223).Crop(10, 20, 50, 50).FirstOrDefault();
    if (thumbnail != null) {
        var html = string.Format("<img url=\"{0}\" width=\"{1}\" height=\"{2}\"/>", thumbnail.Url, thumbnail.Width,
                                 thumbnail.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