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[];
|
||||
}
|
||||
|
||||
const getAspectRatio = (attachment: MediaAttachment) =>
|
||||
(attachment.type === 'gifv' || attachment.type === 'image' || attachment.type === 'video') && attachment.meta.original?.aspect || null;
|
||||
const getAspectRatio = (attachment: MediaAttachment) => {
|
||||
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) =>
|
||||
aspectRatio >= minimumAspectRatio && aspectRatio <= maximumAspectRatio;
|
||||
|
||||
Reference in New Issue
Block a user