- Issue created by @carolpettirossi
- 🇧🇷Brazil carolpettirossi Campinas - SP
Looking at how the module works, it seems that it saves the transformations from the URL. The problem is that the preset doesn't have transformations with the expected structure in the URL.
So the preset format is:
https://trinity.bynder.com/transform/1x1/d5033e2c-5171-47d7-8a33-c2b852e7a7f5/Beta-Gamma-Sigma-240405-036
The custom transformation format is:
https://trinity.bynder.com/transform/0e549895-f5f0-4f09-8c1d-6fa9e9f13179/Beta-Gamma-Sigma-240405-037?io=transform:crop,height:250,width:250,path:circle&focuspoint=0.4,0.26
Note, there's no
io
param in the preset which breaks this part of the code in theBynderSearch
class:public function getTransformations(string $url) { // Cannot use UrlHelper here, because Bynder uses the same query arg for // all transformations. E.g. ?io=transform:fo&io=filter:bar. if ($transformations = parse_url($url, PHP_URL_QUERY)){ return $transformations; } return NULL; }
Then on
BynderFormatter
, when rendering the media entity, the TRANSFORMATIONS_FIELD_NAME returns empty
$media_entity->get(Bynder::TRANSFORMATIONS_FIELD_NAME)->isEmpty()
Results in rendering the image with the default DAT config from the formatter, when in fact I'd like to use the preset.
Any suggestions on how we can improve the module to allow Presets?
- 🇧🇷Brazil carolpettirossi Campinas - SP
It looks like when the media entity is created, we don't save the preset information:
$media[] = $storage->create([ 'bundle' => $image_type->id(), $image_source_field => $bynder_info['id'], 'name' => $bynder_info['name'], Bynder::TRANSFORMATIONS_FIELD_NAME => $transformation, ]);
What's the best approach here? Saving it in the TRANSFORMATIONS_FIELD_NAME? or creating a new field?
- 🇧🇷Brazil carolpettirossi Campinas - SP
Updating this to a Feature Request since it doesn't seem that the module already supports DAT Preset.
- Merge request !283438004: Add ability to use preset DAT transformation with the DAT formatter type. → (Merged) created by carolpettirossi
- Status changed to Needs review
7 months ago 9:35pm 8 April 2024 - 🇧🇷Brazil carolpettirossi Campinas - SP
Can someone review the code I proposed in the MR?
I'm basically suggesting we keep using TRANSFORMATIONS_FIELD_NAME to store the preset. When the URL has the
transform/{preset}/{bynder_id}
structure we save the transformation aspreset:{preset_machine_name}
and the when displaying it, we check for preset: before moving to the "default" approach.Attaching the patch for reference and composer usage
- Status changed to Needs work
7 months ago 2:36pm 12 April 2024 - 🇸🇮Slovenia primsi
Thanks for the MR and work. I tested the patch and added two comments.
From my perspective, same field name is completely fine. Maybe others have different opinions :)
- 🇧🇷Brazil carolpettirossi Campinas - SP
@Primsi, I added another comment aside from the above to the MR.
Please let me know how I can improve this MR and get this into a state where we can push to the module.
Thanks,
Carol - Status changed to RTBC
7 months ago 2:13pm 23 April 2024 - 🇧🇷Brazil carolpettirossi Campinas - SP
@primsi, thanks for working on the MR and improving it. I tested and it works as expected with custom transformation and presets.
Moving this to RTBC
- Status changed to Needs work
7 months ago 8:49pm 23 April 2024 - Status changed to Needs review
7 months ago 12:02pm 25 April 2024 - 🇸🇮Slovenia primsi
The ::submitForm() fails seems to be unrelated, but minor, so I fixed them here. The missing 'derivative' key one is related to this issue but it happens on non-image assets, so I just added an isset().
- Status changed to RTBC
7 months ago 6:06pm 25 April 2024 - 🇧🇷Brazil carolpettirossi Campinas - SP
I've just tested the latest changes, and it's working as expected:
- Can use the default transform base url
- Can use a preset
- Can use a custom transformation -
Berdir →
committed 7b2c843d on 4.x authored by
carolpettirossi →
Issue #3438004: Configure Bynder Image to use DAT Preset selected by the...
-
Berdir →
committed 7b2c843d on 4.x authored by
carolpettirossi →
- Status changed to Fixed
5 months ago 8:44am 7 June 2024 Automatically closed - issue fixed for 2 weeks with no activity.