Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX #3671: add check if custom ratios for images are allowed #3739

Merged

Conversation

NicoleNitschke
Copy link
Collaborator

What I did
I prevent the clear button in the image cropper view to appear, if the yaml-configuration says allowCostum: false. This way, we show only allowed aspect ratios.

How I did it
I changed the code, so that the yaml settings 'allowCustom' for the image editor is respected.

How to verify it
As described in the issue:
Configure a property with an image, forcing the editor to crop the image to one of the provided aspect-ratios.

  properties:
    image:
      type: Neos\Media\Domain\Model\ImageInterface
      ui:
        inspector:
          group: 'media'
          position: 50
          editorOptions:
            crop:
              aspectRatio:
                # we want to force an aspect-ratio when selecting the image
                forceCrop: true
                # we explicitely don't want custom aspect-ratios
                allowCustom: false
                # we set a defaultOption so we don't end up without selected aspect-ratio
                defaultOption: portrait
                options:
                  portrait:
                    label: Portrait
                    width: 2
                    height: 3
                  landscape:
                    label: Landscape
                    width: 3
                    height: 2

Before:

grafik

With bugfix:

grafik

Copy link
Contributor

@grebaldi grebaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @NicoleNitschke.

this makes sense indeed. I was able to verify that your change works like a charm! 👍 Thanks a lot for your work! :)

@NicoleNitschke NicoleNitschke changed the title #3671 - add check if custom ratios for images are allowed BUGFIX #3671: add check if custom ratios for images are allowed Mar 14, 2024
@mhsdesign mhsdesign merged commit 1df37d0 into neos:8.3 Mar 14, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ImageCropper AspectRatioDropDown can always deselect preset
3 participants