mirror of
https://github.com/foomo/contentfulvalidation.git
synced 2025-10-16 12:25:37 +00:00
23 lines
463 B
Go
23 lines
463 B
Go
package validations
|
|
|
|
import (
|
|
"github.com/foomo/contentful"
|
|
"github.com/foomo/contentfulvalidation/utils"
|
|
)
|
|
|
|
func IsLandscapeRatio(asset *contentful.AssetNoLocale) bool {
|
|
aspectRatio, err := utils.GetAspectRatio(asset)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
return aspectRatio >= 1.00
|
|
}
|
|
|
|
func IsPortraitRatio(asset *contentful.AssetNoLocale) bool {
|
|
aspectRatio, err := utils.GetAspectRatio(asset)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
return aspectRatio <= 1.00
|
|
}
|