export interface PhotoSizeLike { width: number; height: number; url?: string; src?: string; } export interface PhotoSize { url: string; width: number; height: number; } /** * Searches for the smallest (?) suitable image from the sizes array. * * Or more precise, it returns: * – if no suitable sizes (>= minWidth И >= minHeight): the biggest from all sizes; * – there are any suitable (>= minWidth И >= minHeight): the smallest of the matching sizes; * * Returns null only in case of an empty/invalid array. The returned size can be smaller than minWidth or minHeight. * * The function doesn't take into about the retina screen (window.devicePixelRatio), so you have to calculate the right width/height from the outside to support it. * * WARN: * - does not reckon for letter-sizes (PhotosPhotoSizesType). * - does not know how to search for the "nearest" size, or the maximum image (there is a hack with the `Infinity` pass). * * @example * getPhotoSize([{ width: 1, height: 1 }, { width: 3, height: 3 }], 1) // => 1,1 * getPhotoSize([{ width: 1, height: 1 }, { width: 3, height: 3 }], 2) // => 3,3 * getPhotoSize([{ width: 1, height: 1 }, { width: 3, height: 3 }], 4) // => 3,3 * * See more examples in tests */ export declare function getPhotoSize(sizes: PhotoSizeLike[], minWidth: number, minHeight?: number | null): PhotoSize | null;