Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #51132
artemiomorales opened this issue Jun 30, 2023 · 0 comments · Fixed by #52178
Assignees
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Enhancement A suggestion for improvement.

Comments

@artemiomorales
Copy link
Contributor

artemiomorales commented Jun 30, 2023

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.

@artemiomorales artemiomorales added [Type] Enhancement A suggestion for improvement. [Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. labels Jun 30, 2023
@artemiomorales artemiomorales 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 Jun 30, 2023
@artemiomorales artemiomorales self-assigned this Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Feature] Interactivity API API to add frontend interactivity to blocks. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant