Allow additional subsizes for images (#1734)#1749
Conversation
* Allow additional subsizes for images * fix: Remove duplicate subsizes * fix: Add all subsizes to rtgodam_image_sizes * fix: Skip invalid requests with crop true but values not set * fix: Frontend srcset for CDN URLs * fix: Address copilot comments --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the GoDAM image subsize pipeline so that all WordPress-registered image subsizes (core + theme/plugin sizes) can be requested from GoDAM Central, persisted into rtgodam_image_sizes, and correctly used on the frontend (including srcset) when images are served from CDN URLs.
Changes:
- Expand subsize generation requests to include all
wp_get_registered_image_subsizes()entries, skip invalid crop requests, and deduplicate outgoing size requests. - Update subsize-to-size-name mapping when persisting CDN sizes into attachment metadata and
rtgodam_image_sizes. - Improve frontend CDN
srcsetbehavior by pre-filtering srcset meta and deduplicating injected sources by width.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| inc/classes/rest-api/class-media-library.php | Adjusts how registered subsizes are requested from GoDAM Central and how returned subsizes are mapped/persisted into metadata. |
| inc/classes/class-media-library-ajax.php | Adds a wp_calculate_image_srcset_meta pre-filter and refines CDN srcset/content <img> handling for GoDAM-managed images. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
missing_composer_json_file | The "/vendor" directory using composer exists, but "composer.json" file is missing. |
📁 readme.txt (2 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (6 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/03/20/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/?godam-video=demo-godam-video-post (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (6 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/03/20/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/?godam-video=demo-godam-video-post (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Allow additional subsizes for images (#1734) (#1749) * Allow additional subsizes for images (#1734) * Allow additional subsizes for images * fix: Remove duplicate subsizes * fix: Add all subsizes to rtgodam_image_sizes * fix: Skip invalid requests with crop true but values not set * fix: Frontend srcset for CDN URLs * fix: Address copilot comments --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com> * fix: Find the best fit in subsizes --------- Co-authored-by: Kuldip Chaudhary <64731232+KMchaudhary@users.noreply.github.com> Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix data duplication issue (#1744) * Fix duplicate data * Add label to differentiate metrics * Address copilot comments * Fix duplication and request drop * Fix GTMTracker double-initialization bug * docs: Update changelog and version to 1.7.2 (#1750) --------- Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com> Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> Co-authored-by: Vishal Kumar <vishnshiv3@gmail.com>
Issue - https://github.com/rtCamp/godam-core/issues/936, https://github.com/rtCamp/godam-core/issues/935
Allow additional subsizes for images
fix: Remove duplicate subsizes
fix: Add all subsizes to rtgodam_image_sizes
fix: Skip invalid requests with crop true but values not set
fix: Frontend srcset for CDN URLs
fix: Address copilot comments