- Consider merging
get_image_tag()
andwp_get_attachment_image()
.- Nah, bad idea. While
get_image_tag()
is only used in the media editor, it probably makes sense to keep the image generation on the back end and front end separated because of how people are likely filtering display.
- Nah, bad idea. While
- Add an event listener to the editor if we can't do a content filter.
- Look into adding needed metadata directly to wp.media to avoid the ajax request
- Add caching to
attachment_url_to_postid
to speed up multiple requests. - Add smart ways to filter
sizes
globally w/o inducing anotherwp_get_attachment_image()
call.
- We might be able to set the srcset and sizes attributes directly in the updateImage function in wpeditimage/plugin.js
imageData
still contains meta from the original image being replaced instead of the new image being inserted. UPDATE: not true. It just doesn't update the customWidht/customHeight properties.- We have an id, size, and width right there in
imageData
, so we should be golden.
This is what needs to happen:
On update, see if this is a different image and, if so:
- Use the id to retrieve intermediate sizes
- Check aspect ratio against our aspect ratio property
- Build the srcset attribute
- Build a sizes attribute
Questions to resolve:
- How do we get the intermediate sizes for an image, now that we have the id since that data isn't passed to the tinyMCE editor as far as I can tell?
- We need to update the sizes attribute after the image is resized using the corner handles in MCE
- Get all the images including the uploads dir.
- Get id & size. a) check via class attributes b) parse the src url directly
- retrieve
srcset
andsizes
attributes - rewrite HTML and return