I posted this question on WordPress Stack Exchange a couple of days ago, but I didn't receive any answer. Now I'm reposting it here hopefully I will get the answer.
I need to filter the URL of the thumbnails in the Media Grid (or any admin pages) by getting the original image URL and adding some URL parameters to generate the thumbnail on the cloud using the AWS Serverless Image Handler.
Suppose I have this original image URL:
https://cdn.example.com/2023/02/20/1234567890-original.jpg
And I don't have any sizes metadata stored in DB for that image. I need to find the proper hook where I can return something like this URL for the thumbnails in the Media Grid or any image displayed on the admin pages:
https://cdn.example.com/2023/02/20/1234567890-original.jpg?size=240x240
I'm planning here to avoid storing any thumbnail sizes in the attachment metadata in DB, and then generating any needed size on the fly using the mentioned library.
Is there any proper hook that is being triggered before returning the thumbnail size URL?
Ran into a similar problem. We don't want to generate a bunch of thumbnails, so we turn those off.
As of late 2022 the image name still seems to get passed through. We hook into
wp_get_attachment_image_srcfor now. We are using named transforms with our CND.I'v attempted custom src-set generation and it is an ugly ugly kludge. I'd rather have this all stored as image meta at image create time or recreated during "thumbnail regeneration".