Skip to content

Image Block: Devise alternative to getimagesize() to prevent unnecessary network requests when using lightbox #52172

Closed

Description

@artemiomorales

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.

Activity

  1. added
    [Type] Enhancement
    [Block] Image
    [Feature] Interactivity API
    on Jun 30, 2023
  2. changed the title [-]Devise alternative to `getimagesize()`, which we use in order to determine the width and height for images inserted via link, to prevent unnecessary network requests. Related discussion here.[/-] [+]Image Block: Devise alternative to `getimagesize()` to prevent unnecessary network requests when using lightbox[/+] on Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

[Block] Image[Feature] Interactivity API[Type] Enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions