Image Conversion
An image format converts the original item to an image. Here you can specify output format (gif/jpg/tiff etc), size, aspect ratio, dpi and more.
To request a image conversion using the declarative model you create a property of type Image or Thumbnail.
public class GalleryImage : MediaItem {
[ResizeEffect(Width=200)]
public Thumbnail Thumbnail { get; set; }
}
You can also specify a specific target output format using the ChangeOutputFormatEffectAttribute
public class GalleryImage2 : MediaItem {
[ChangeOutputFormatEffect("image/webp")]
[ResizeEffect(Width=200)]
public Thumbnail Thumbnail { get; set; }
}
When retrieving the conversion you can get the URL of the content and all other properties that exists on the MediaItem class.
var client = ClientFactory.GetSdkClient();
var galleryImages = client.Query<GalleryImage>().Where(m => m.VaultId == 30)
.OrderBy(m => m.DateAdded).Take(20).ToList();
foreach (var galleryImage in galleryImages) {
Console.WriteLine(galleryImage.Name + "," + galleryImage.Thumbnail.Url);
}