@adonis-agora/media
Version:
Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a
17 lines • 708 B
JavaScript
/** Does this preset crop (and so care about a focal point / position)? */
export function presetCrops(preset) {
return Boolean(preset.width && preset.height && (preset.fit ?? 'cover') === 'cover');
}
/** The record's focal point, if `customProperties.focalPoint` holds a valid one. */
export function focalPointOf(customProperties) {
const point = customProperties.focalPoint;
if (!point || typeof point !== 'object')
return undefined;
const { x, y } = point;
if (typeof x !== 'number' || typeof y !== 'number')
return undefined;
if (!(x >= 0 && x <= 1 && y >= 0 && y <= 1))
return undefined;
return { x, y };
}
//# sourceMappingURL=image_processor.js.map