Skip to content

fix: get lesser between wp threshold and user max dimension#44

Open
Arukuen wants to merge 1 commit intodevelopfrom
fix/43-metadata-fix-on-scale
Open

fix: get lesser between wp threshold and user max dimension#44
Arukuen wants to merge 1 commit intodevelopfrom
fix/43-metadata-fix-on-scale

Conversation

@Arukuen
Copy link
Copy Markdown
Contributor

@Arukuen Arukuen commented Apr 14, 2026

fixes #43

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for WordPress scaling thresholds in image processing configuration.
  • Bug Fixes

    • Enhanced image scaling logic to evaluate both application and WordPress scaling limits, applying the more restrictive threshold to ensure optimal image handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d9f8da6-a5ff-42fd-8ec0-267de7a90c91

📥 Commits

Reviewing files that changed from the base of the PR and between 9cae3df and 4b1f2ff.

📒 Files selected for processing (2)
  • src/admin/class-script-loader.php
  • src/shared/converters/index.js

📝 Walkthrough

Walkthrough

The PR integrates WordPress's automatic image scaling threshold into the optimization pipeline. The backend now exposes the WordPress big_image_size_threshold filter value to JavaScript, and the converter applies the minimum of the plugin's max dimension and WordPress's threshold when optimizing images.

Changes

Cohort / File(s) Summary
WordPress Scaling Threshold Integration
src/admin/class-script-loader.php, src/shared/converters/index.js
Backend reads WordPress's big_image_size_threshold filter (default 2560px) and passes it to frontend as wpScalingThreshold. Frontend image converter now calculates finalMaxDimension as the minimum of maxImageDimension and wpScalingThreshold, with fallback logic for when either value is unset.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A threshold from WordPress we now embrace,
Two limits dance to find their place—
The smaller wins, the image scales just right,
No more mismatches in metadata's sight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: accounting for WordPress scaling threshold alongside user max dimension to fix metadata mismatch.
Linked Issues check ✅ Passed The code changes implement the fix for issue #43 by retrieving the WordPress scaling threshold via filter and using the lesser value between threshold and user max dimension.
Out of Scope Changes check ✅ Passed All changes directly address the metadata mismatch issue by introducing WordPress threshold support and dimension calculation logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/43-metadata-fix-on-scale

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

🤖 Pull request artifacts

file commit
pr44-cimo-44-merge.zip 4b1f2ff

github-actions bot added a commit that referenced this pull request Apr 14, 2026
@bfintal
Copy link
Copy Markdown
Contributor

bfintal commented Apr 16, 2026

@Arukuen Please add:

  • placeholder for the maximum resize dimensions in Cimo settings
  • Adjust also the description for this setting to say that the WordPress maximum dimension of 2560 is used

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.

When Wordpress Automatic Image Scaling is ON, the file size in metadata does not match with the final.

2 participants