pl-fe: fix missing aspect ratio case when height and width is provided
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -40,8 +40,15 @@ interface SizeData {
|
|||||||
itemsDimensions: Dimensions[];
|
itemsDimensions: Dimensions[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAspectRatio = (attachment: MediaAttachment) =>
|
const getAspectRatio = (attachment: MediaAttachment) => {
|
||||||
(attachment.type === 'gifv' || attachment.type === 'image' || attachment.type === 'video') && attachment.meta.original?.aspect || null;
|
if ((attachment.type === 'gifv' || attachment.type === 'image' || attachment.type === 'video') && attachment.meta.original) {
|
||||||
|
if (attachment.meta.original.aspect) {
|
||||||
|
return attachment.meta.original.aspect;
|
||||||
|
}
|
||||||
|
return attachment.meta.original.width / attachment.meta.original.height;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
const withinLimits = (aspectRatio: number) =>
|
const withinLimits = (aspectRatio: number) =>
|
||||||
aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio;
|
aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio;
|
||||||
|
|||||||
Reference in New Issue
Block a user