8000 Filter Watermark - allow h_ratio and w_ratio as a real number by asokani · Pull Request #1701 · thumbor/thumbor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Filter Watermark - allow h_ratio and w_ratio as a real number #1701

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

asokani
Copy link
@asokani asokani commented Nov 4, 2024

In order to set the exact size of the watermark, I need to have the percentage value as a real number. There is no reason not to. This is backward compatible

Copy link

Copy link

This PR is stale because it has been open 60 days with no activity. Remove the stale label or add a comment, or this PR will be closed in 30 days. You can always re-open if you feel this is something we should still keep working on. Tag @heynemann for more information.

@github-actions github-actions bot added the Stale label Jan 14, 2025
@asokani
Copy link
Author
asokani commented Jan 14, 2025

Hey @heynemann I think this patch is useful.

@github-actions github-actions bot removed the Stale label Jan 14, 2025
Copy link

This PR is stale because it has been open 60 days with no activity. Remove the stale label or add a comment, or this PR will be closed in 30 days. You can always re-open if you feel this is something we should still keep working on. Tag @heynemann for more information.

@coveralls
Copy link
coveralls commented Apr 2, 2025

Pull Request Test Coverage Report for Build 15068229951

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 89.093%

Totals Coverage Status
Change from base Build 15050309760: 0.0%
Covered Lines: 3888
Relevant Lines: 4364

💛 - Coveralls

Copy link
sonarqubecloud bot commented Apr 4, 2025

@RaphaelVRossi
Copy link
Member

Hey @asokani, thank you for your interest in contributing to Thumbor!

Could you please explain this regex? It seems a bit like magic to me.

Additionally, we should update the documentation for the watermark filter with this new use case. The source code for it is here: https://github.com/thumbor/thumbor/blob/master/docs/watermark.rst

In order to set the exact size of the watermark, I need to have the percentage value as a real number. There is no reason not to. This is backward compatible
Copy link

@asokani
Copy link
Author
asokani commented May 16, 2025

Hello @RaphaelVRossi. Thanks for asking. The regex comes straight from https://github.com/thumbor/thumbor/blob/master/thumbor/filters/__init__.py#L132
We can't use it in this context "as is" though, because we also need to support string "none". In short, there are four options: DDD.optional_DDD | optional_DDD.DDD | DDD | none (D means digit).

I've also updated the docs. I explicitly pointed out that percentages can be real numbers. In fact - percentages are ALWAYS real numbers. I don't know why there was an artificial restriction to only whole integers. That never made sense.

Copy link
sonarqubecloud bot commented Jul 4, 2025

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
0