AdvancedCustomFields / AdvancedCustomFields/acf
Image Field: wrong preview size before initial save
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
To demonstrate the problem, a single image field is needed and a custom image size. I'll just use a portrait format with the dimensions 300x420 here for easier demonstration. The image size is registered using this function in the function.php:
add_image_size('assets', 300, 420, true);
Then one image is uploaded, and all the needed sizes are generated without a problem:
-rw-r--r-- 1 wp wp 1084 May 20 15:42 test-600x600-1-150x150.png
-rw-r--r-- 1 wp wp 2704 May 20 15:42 test-600x600-1-300x300.png
-rw-r--r-- 1 wp wp 4662 May 20 15:42 test-600x600-1-300x420.png
-rw-r--r-- 1 wp wp 1840 May 20 15:42 test-600x600-1.png
Here you can see the field config:

I then open a post and select the image using the Media Library. Without saving the post, the image is displayed inside the field with the default format "Medium", but not with my configured size "Assets":

If I now click on save, the page reloads and the Image Field shows the mage in the correct size:

Would it be possible to correct this so, that the correct preview size is displayed directly after selecting the image?
I have already discussed the problem with your support and it was recommended to me to make an entry here. :)
Thanks,
Martin
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with one image field, a registered 300x420 custom size, and an image selected before saving the post. Compare the pre-save preview with the post-save preview; done means the configured Assets size is shown immediately after selection rather than the default Medium size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100