-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from AmazeeLabs/SLB-385-focalpoint-waku
SLB-385: focalpoint in waku
- Loading branch information
Showing
23 changed files
with
1,835 additions
and
2,316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
_core: | ||
default_config_hash: 7eGOTSG7bRv_AAqu-Ls8CSnob7zPF1ez-lD2OLZgBHs | ||
flush_derivative_images: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
uuid: 928fcf6c-e6b0-43d2-bef3-50ae2d1cced0 | ||
langcode: en | ||
status: true | ||
dependencies: { } | ||
_core: | ||
default_config_hash: flCi9IdafdLXlJqvoHguutUOiC05-aynK4niYN4YZ3o | ||
label: 'Focal point' | ||
id: focal_point | ||
description: 'Crop type used by Focal point module.' | ||
aspect_ratio: '' | ||
soft_limit_width: null | ||
soft_limit_height: null | ||
hard_limit_width: null | ||
hard_limit_height: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
_core: | ||
default_config_hash: 8JOAPEbjHMB4rDFCsu3EXEx6L2UDQ5SSDyN0d7S0Ic0 | ||
crop_type: focal_point | ||
default_value: '50,50' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
label: Fokuspunkt | ||
description: 'Der vom Focal-Point-Modul verwendete Zuschnittstyp' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Drupal\custom; | ||
|
||
use Drupal\crop\Entity\Crop; | ||
use Drupal\file\Entity\File; | ||
use Drupal\graphql_directives\DirectiveArguments; | ||
|
||
/** | ||
* Helper service for focalpoint information. | ||
*/ | ||
class FocalPoint { | ||
|
||
/** | ||
* Retrieve the focal point of an image entity. | ||
* | ||
* @param \Drupal\graphql_directives\DirectiveArguments $args | ||
* The directive arguments. | ||
* | ||
* @return array | ||
* The focal point coordinates. | ||
*/ | ||
public static function getFocalPoint(DirectiveArguments $args): array { | ||
if ($args->value instanceof File) { | ||
$filePath = $args->value->getFileUri(); | ||
|
||
$crop = Crop::findCrop($filePath, 'focal_point'); | ||
$x = $crop?->x->value; | ||
$y = $crop?->y->value; | ||
if ($x && $y) { | ||
return [ | ||
$x, | ||
$y, | ||
]; | ||
} | ||
} | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
packages/drupal/test_content/content/crop/101ccff9-3733-480e-aca1-392253376a48.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
_meta: | ||
version: '1.0' | ||
entity_type: crop | ||
uuid: 101ccff9-3733-480e-aca1-392253376a48 | ||
bundle: focal_point | ||
default_langcode: en | ||
default: | ||
entity_id: | ||
- | ||
value: 5 | ||
entity_type: | ||
- | ||
value: file | ||
uri: | ||
- | ||
value: 'public://2023-04/decoupled-architecture.png' | ||
x: | ||
- | ||
value: 1000 | ||
'y': | ||
- | ||
value: 549 | ||
revision_timestamp: | ||
- | ||
value: 1725914614 | ||
revision_uid: | ||
- | ||
target_id: 1 |
28 changes: 28 additions & 0 deletions
28
packages/drupal/test_content/content/crop/10743cfc-604c-4a07-baf3-e267d9c89ff6.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
_meta: | ||
version: '1.0' | ||
entity_type: crop | ||
uuid: 10743cfc-604c-4a07-baf3-e267d9c89ff6 | ||
bundle: focal_point | ||
default_langcode: en | ||
default: | ||
entity_id: | ||
- | ||
value: 3 | ||
entity_type: | ||
- | ||
value: file | ||
uri: | ||
- | ||
value: 'public://media-icons/generic/generic.png' | ||
x: | ||
- | ||
value: 90 | ||
'y': | ||
- | ||
value: 90 | ||
revision_timestamp: | ||
- | ||
value: 1725914614 | ||
revision_uid: | ||
- | ||
target_id: 1 |
Oops, something went wrong.