Codeinwp / Codeinwp/optimole-wp

consider wp_constrain_dimensions for Limit Image Dimensions with max width/height

Open
#676 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

new feature
Dominant language
PHP
Stars
72
Forks
14
Avg merge
2d 9h
Merged PRs (30d)
15

Description

What problem does this address?

Right now seems like we are doing our own scaling procedure to keep the ratio when Limit Image Dimensions with max width/height is on.

What is your proposed solution?

I would suggest wp_constrain_dimensions like we do here https://github.com/Codeinwp/optimole-wp/blob/master/inc/url_replacer.php#L255C46-L255C69

Discovered this while looking on #675

Will this feature require documentation? (Optional)

No.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in inc/url_replacer.php at the scaling logic around lines 241-246 and the existing wp_constrain_dimensions usage around line 255. Compare the Limit Image Dimensions path with that helper and verify that width, height, and aspect ratio remain correct. Done means the duplicated scaling procedure is replaced or aligned without changing the intended dimension limits.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.