From ed479312fac213737164c53bf1b3619a5b1e1ff3 Mon Sep 17 00:00:00 2001 From: Pascal Martineau Date: Thu, 25 Sep 2025 15:22:06 -0400 Subject: [PATCH] feat: imageCenter field --- wp-content/themes/ccat/functions.php | 1 + .../ccat/includes/graphql/image-center.php | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 wp-content/themes/ccat/includes/graphql/image-center.php diff --git a/wp-content/themes/ccat/functions.php b/wp-content/themes/ccat/functions.php index 0fb93df..e1dd48f 100644 --- a/wp-content/themes/ccat/functions.php +++ b/wp-content/themes/ccat/functions.php @@ -29,6 +29,7 @@ require_once __DIR__ . '/includes/taxonomies/resource-category.php'; require_once __DIR__ . '/includes/graphql/auth.php'; require_once __DIR__ . '/includes/graphql/address.php'; require_once __DIR__ . '/includes/graphql/breadcrumbs.php'; +require_once __DIR__ . '/includes/graphql/image-center.php'; // Roles diff --git a/wp-content/themes/ccat/includes/graphql/image-center.php b/wp-content/themes/ccat/includes/graphql/image-center.php new file mode 100644 index 0000000..a6099f7 --- /dev/null +++ b/wp-content/themes/ccat/includes/graphql/image-center.php @@ -0,0 +1,22 @@ + 'String', + 'description' => 'Image center point for cropping (e.g., "50% 50%")', + 'resolve' => function ( $source, $args, $context, $info ) { + if ( empty( $position = get_post_meta( $source->databaseId, 'theiaSmartThumbnails_position', true ) ) ) { + return null; + } + $x = round( $position[0], 4 ); + $y = round( $position[1], 4 ); + return "$x% $y%"; + }, + ) + ); +}