Image Block: Devise alternative to getimagesize()
to prevent unnecessary network requests when using lightbox
#52172
Labels
[Block] Image
Affects the Image Block
[Feature] Interactivity API
API to add frontend interactivity to blocks.
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
We currently use the
wp_getimagesize()
function to determine an image's height and width when using external images in order to calculate CSS values for the lightbox. However, this creates unnecessary network requests and also breaks when external images are no longer present at the specified URL.What is your proposed solution?
When using external images, we actually don't need to fetch the width and height data because the responsive image in the content is the largest image we have available, so we should be able to remove the call to
wp_getimagesize()
and revise the logic, and the lightbox should still work without issues.The text was updated successfully, but these errors were encountered: