Skip to content

[6.x] Forms 2: Resolve Image Choice images from the configured container - #16007

Merged
duncanmcclean merged 1 commit into
6.xfrom
fix-image-choice-container
Nov 26, 2026
Merged

duncanmcclean merged 1 commit into
6.xfrom
fix-image-choice-container

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where Image Choice ignored the configured statamic.assets.image_choice_images.container when resolving option images.

This was happening because bare image paths (without a container:: prefix) were resolved by asking every asset container for the path and taking the first match. This meant one asset lookup per option per container on every render, preload and chart (slow with remote storage like S3), and the wrong image could be shown when the same path existed in multiple containers.

This PR fixes it by only looking in the configured container when it exists. When no container is configured, or the configured one doesn't exist, it still searches every container, but now stops at the first match.

Amp thread: https://ampcode.com/threads/T-01a20811-4b7d-7495-a8d2-e6bfe1ffce86

Base automatically changed from forms-2 to 6.x November 24, 2026 17:49
@jasonvarga
jasonvarga force-pushed the fix-image-choice-container branch from 66e204d to 43ea74e Compare November 24, 2026 20:19
@duncanmcclean
duncanmcclean merged commit 6d71910 into 6.x Nov 26, 2026
64 checks passed
@duncanmcclean
duncanmcclean deleted the fix-image-choice-container branch November 26, 2026 16:20
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.

2 participants