Skip to content

Allow additional subsizes for images (#1734)#1749

Merged
subodhr258 merged 2 commits intomainfrom
hotfix/allow-all-image-subsizes
Mar 20, 2026
Merged

Allow additional subsizes for images (#1734)#1749
subodhr258 merged 2 commits intomainfrom
hotfix/allow-all-image-subsizes

Conversation

@subodhr258
Copy link
Copy Markdown
Collaborator

@subodhr258 subodhr258 commented Mar 20, 2026

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


* 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 srcset behavior 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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 20, 2026

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
16 0 16

⚠️ Warnings (16)

📁 composer.json (1 warning)
📍 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@subodhr258 subodhr258 merged commit 26cbfce into main Mar 20, 2026
10 checks passed
@subodhr258 subodhr258 deleted the hotfix/allow-all-image-subsizes branch March 20, 2026 08:39
KMchaudhary added a commit that referenced this pull request Mar 23, 2026
* 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>
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