UNPKG

astro-cloudinary

Version:

<a href="https://github.com/cloudinary-community/astro-cloudinary/actions/workflows/test_and_release.yml"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/cloudinary-community/astro-cloudinary/test_and_release.y

28 lines (24 loc) 985 B
import { OG_IMAGE_WIDTH, OG_IMAGE_HEIGHT } from '../constants/sizes.js'; import { getCldImageUrl } from './getCldImageUrl.js'; import type { GetCldImageUrlOptions, GetCldImageUrlConfig, GetCldImageUrlAnalytics } from './getCldImageUrl.js'; /** * getCldImageUrl */ export type GetCldOgImageUrlOptions = GetCldImageUrlOptions; export type GetCldOgImageUrlConfig = GetCldImageUrlConfig; export type GetCldOgImageUrlAnalytics = GetCldImageUrlAnalytics; export function getCldOgImageUrl(options: GetCldOgImageUrlOptions, config?: GetCldOgImageUrlConfig, analytics?: GetCldOgImageUrlAnalytics) { return getCldImageUrl({ ...options, format: options.format || 'jpg', width: options.width || OG_IMAGE_WIDTH, height: options.height || OG_IMAGE_HEIGHT, crop: options.crop || { width: options.width || OG_IMAGE_WIDTH, height: options.height || OG_IMAGE_HEIGHT, type: 'fill', gravity: 'center', source: true } }, config, analytics); }