Right now, things aren't ideal with the image dimension extractor.
- Everything is done on render, which makes things slow.
- The attachment metadata extractor is super slow on sites with lots of attachments.
- We often end up having to fetch a remote image to calculate its dimensions, which is slow.
- With lots of images on a post (e.g. gallery), we may end up taking a long time to generate the page.
- fastimage has some flaws.
- We do store the values in transients, but those expire after a while.
A few options to work with here: - Do the dimension calculations on upload and store them in meta. - For images without meta (uploaded when the plugin wasn't active): - Maybe a safe, async way to backfill image data. - Find a better/faster/more reliable library than fastimage (like https://github.com/willwashburn/fasterimage although this is PHP5.4+ only and we support 5.2+). - Use a 3rd party service to do the dimension extraction (something like Photon, although, that requires Jetpack support).
该提问来源于开源项目:ampproject/amp-wp