Querying formats

When we request a media, we always supply the id of the mediaItem and a format, either by declaration on a class, using the Client.Load method and supplying formatting calls like Resize or invoking the Find method directly and supply a format definition or id (or by using the Client.Load method and invoking the UseFormat method.

To get an id of a Format we need to request it using the Query method and ask for a specific format.

var client = ClientFactory.GetSdkClient();
var imageFormat = client.Query<ImageFormat>().Single(x => x.Width == 200 && x.Height == 100);
var formatId = imageFormat.Id;

You will always get a matching format (a system format) that is created for you if no suitable format exists.

comments powered by Disqus
+46 (0)480 - 31 47 95
info@imagevault.se
English website