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

Update catalog metadata when removing cropping info #146

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

petschki
Copy link
Member

@petschki petschki commented Oct 7, 2023

Note: Somehow I could not do this via CroppingInfoRemovedEvent because this didn't get fired. In addition, the event gets fired when changing the cropping information too, so the object had been reindexed twice...

@petschki petschki requested a review from MrTango October 7, 2023 10:17
@petschki petschki requested a review from laulaz October 7, 2023 10:57
Copy link
Contributor

@MrTango MrTango left a comment

Choose a reason for hiding this comment

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

looks good, i changed it a bit, so that the CroppingInfoRemovedEvent is not fired when the crop is changed, but only when the crop is removed.

Comment on lines +39 to +44
if height >= 65536:
# special case for "flexible height" settings:
# we calculate the height with the box ratio
box_width = self.box[2] - self.box[0]
box_height = self.box[3] - self.box[1]
height = int(round(width / box_width * box_height))
Copy link
Member

Choose a reason for hiding this comment

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

@petschki why is that code in this unrelated PR ?
If you confirm it is just an omission on master, I merge this, no problem 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, I was working on this too on Saturdays sprint and so the title of the PR is a bit missleading. This is needed in order to scale down correctly when cropping the "flexible height" scale. Otherwise It ended up in square scaled image always.

In general I'm not really happy with this hardcoded pixel value, but it works for the new OOTB image scales though. If one creates a custom scale with "100x65000" she/he might get messed 😁

@laulaz laulaz merged commit 25a8952 into master Oct 9, 2023
7 checks passed
@laulaz laulaz deleted the petschki-croppinginforemove-fix branch October 9, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants