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

Allow single dimension for aspect ratio and pixel mode #105

Open
mkalamarz opened this issue Mar 14, 2022 · 1 comment
Open

Allow single dimension for aspect ratio and pixel mode #105

mkalamarz opened this issue Mar 14, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@mkalamarz
Copy link

Hello,
in the current WordPress version (6.0.1), as far as I know, there is no option for "original aspect ratio" or to "calculate other dimension" for the situation when only one dimension should be limited.

I need to restrict only width for my CPT image field (500px) and not the height.

What I would expect from the plugin, would be to let me select "Pixel size", provide Width=500 and empty Height.

There is of course a problem of making the Height field optional, which could end up in someone simply omitting it by mistake. I see two possible solutions:

  1. Leave Height as required field and allow "0" or "-1" as "resize with original aspect ratio". This could be explained in docs/changelog or as field description.
  2. Make Height optional and if empty "resize with original aspect ratio" but add description in a way mentioned in 1.

@joppuyo let me know, what do you think. For me, it was surprising that this option isn't already present.

@joppuyo
Copy link
Owner

joppuyo commented Mar 15, 2022

Unfortunately this use case is not supported and that's a conscious decision.

This plugin has a main purpose to crop an image to a specific aspect ratio, the pixel size support is a secondary feature. In order to crop an image to an aspect ratio, there needs to be a width and a height, if one of these is missing, it's essentially the same as a free crop.

The only way I would envision having a feature like this (free crop with constraints) is if there's an option of defining a minimum and maximum aspect ratio, for example that the image needs to be at minimum 1x1 and at maximum 16x9. This could also work with pixel sizes, for example the minimum pixel size is 100x100 pixels and the maximum pixel size is 178x100. The user could then select a portion of the image between this minimum and maximum.

I'm currently focused on version 7.0.0 of the plugin which is a partial rewrite of the plugin so any new feature like this would have to come after that.

@joppuyo joppuyo added the enhancement New feature or request label Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants