Support #22034
closedImages don't appear in Classic Editor
0%
Description
Gene Fellner writes
"My Common’s site address is https://ued73200sp2025.commons.gc.cuny.edu/. We seem to be unable to upload images to that site."
When I tried, https://ued73200sp2025.commons.gc.cuny.edu/2025/02/07/image-testing/, it did work for me, though on the back end it looked like it wouldn't (see attached images)
Files
Related issues
Updated by Marilyn Weber about 2 months ago
Gene replied:
So I just loaded an image in reply to yours, and it looked like it loaded but when I clicked on the image it said, “the image failed to load.”
Updated by Marilyn Weber about 2 months ago
- Tracker changed from Bug to Support
- Subject changed from Gene to more image problems
Updated by Boone Gorges about 1 month ago
- Subject changed from more image problems to Images don't appear in Classic Editor
- Category name set to S3 Uploads
- Assignee set to Boone Gorges
- Target version set to 2.5.2
To clarify for future reference:
1. On a non-public site, edit a post using the Classic Editor
2. Insert an image
3. The image will appear as a blank box in the Classic Editor
4. Publish/save
5. The image will appear as expected on the front end.
The issue has to do with a peculiarity of the way the Classic Editor builds markup. The wp_send_attachment_to_editor()
stack includes a call to image_downsize()
, where some weird string manipulation happens: the image URL is fetched with wp_get_attachment_url()
, which is properly filtered and has the S3 signature query args, but then some manipulation is done using wp_basename
in such a way that the query args are stripped. (And really, any query args are stripped. Seems like a bug in WP to me.) Anyway, the solution is to reapply the S3 filter after this happens, which I've done at the get_image_tag
filter. See https://github.com/cuny-academic-commons/cac/commit/d305a1484d7b3d954106e2ed294e6fb3dc2afae3
Marilyn, can you confirm that things are now working as expected? If not, please share URLs and specific details on how to reproduce.
Updated by Boone Gorges about 1 month ago
- Status changed from New to Resolved
I've deployed these changes to the production site, so I'm going to mark the ticket resolved. Marilyn, if you hear that the problem is not indeed fixed, please let me know and I'll continue to investigate.
Updated by Marilyn Weber about 1 month ago
Gene replies:
"I did not understand the reply from the dev team.
When starting a new post, the image loads. But when replying to a post with an image, the image does not load.
I just made a third reply to your post but with the same result. I attached an image, but then when I clicked on it, I got the same error message “This image failed to load.”
Updated by Boone Gorges about 1 month ago
Thanks for circling back.
"I did not understand the reply from the dev team.
Well, the technical bits were certainly not meant for the user to understand :-D
When starting a new post, the image loads. But when replying to a post with an image, the image does not load.
I just made a third reply to your post but with the same result. I attached an image, but then when I clicked on it, I got the same error message “This image failed to load.”
Perhaps you can get more information here. Specific URLs are an absolute must. And I'm unsure what it means to "reply" to a post.
Updated by Marilyn Weber about 1 month ago
He clarifies "If I start a post I can insert an image. But if I want to reply to a post that someone else begins, and add an image to that reply, I get the error message that it didn’t upload. You can see this happening in my replies to the post that you began. I tried to reply with an image, but when I then click on that image I get the message “This image failed to load.”"
We've been working together here - https://ued73200sp2025.commons.gc.cuny.edu/2025/02/07/image-testing/.
Updated by Boone Gorges about 1 month ago
Thanks for the clarification. This problem appears to be tied to the wpdiscuz plugin, and is unrelated to the original report of image problems when editing in the Classic Editor. I've opened a new ticket to track it, with a request for more info: https://redmine.gc.cuny.edu/issues/22066
Updated by Boone Gorges about 1 month ago
- Related to Bug #22066: Images in wpdiscuz comments don't appear as expected added
Updated by Marilyn Weber about 1 month ago
User reports success and sends a big thank you!