Skip to content

Lazy Load + Photon will fail to show some images when there is a need to scale #530

@rase-

Description

@rase-

When we need to scale images due to, e.g., zoom or retina display, before scrolling to an image that is lazily loaded, the width and height attributes will be set to placeholder image dimensions in http://s0.wp.com/wp-content/js/devicepx-jetpack.js. Here is a small demonstration, where in the console you can see that the width and height are set before even taking away the data-recalc-dims flag. Setting the attributes too early will result in a 1 x 1 px image instead of the expected.

The comment in photon.js Modify given image's markup so that devicepx-jetpack.js will act on the image indicates (at least in my opinion) that devicepx-jetpack.js will only act on the image after the reset_for_retina call, even though this doesn't seem to be the case currently. I think it would make sense to not scale the image (in devicepx-jetpack.js) if data-recalc-dims is still set, postponing the scaling until the image is actually loaded and photon.js has been able to set the image dimensions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Photonaka "Image CDN". Feature developed in the Image CDN package and shipped in multiple plugins[Type] BugWhen a feature is broken and / or not performing as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions