Code Monkey home page Code Monkey logo

Comments (6)

lmartins avatar lmartins commented on June 13, 2024

Looking forward for this release too. Thanks.

from wp-tevko-responsive-images.

joemcgill avatar joemcgill commented on June 13, 2024

Looks like there are two different cases we need to be aware of with Jetpack's Photon module:

Content images: Photon doesn't affect images being added to content, but instead adds a filter to the_content that finds all images in a post and swaps out the src attribute for the photon url when they are displayed on the front end. (FWIW, the code for that filter is pretty nice and could be useful when we filter sizes attributes in the content).

Template images: When we're building image tags on the front end—for a featured image or any other manually generated image tag—Photon is filtering image_downsize(), which is what wp_get_attachment_image_src() uses to return an array containing the url, width, and height of an image. We use the width and height information to determine srcset candidates. However, Photon's filter returns a url string for the url and false for the height and width attributes that we need. We could shim this on our end, which is what the suggested patch from the support forum linked above does, but ultimately I think this is a bug with Photon and we should reach out to them with a fix for their filter.

from wp-tevko-responsive-images.

tevko avatar tevko commented on June 13, 2024

@joemcgill agreed. Let's raise an issue in slack tomorrow

from wp-tevko-responsive-images.

joemcgill avatar joemcgill commented on June 13, 2024

After talking this through with the JetPack team, they are intentionally returning falsey values for height and width and they're not likely to fix this. Additionally, they're handling a lot of the optimizations that we are providing on their end, so we really don't need to worry about adding support for Photon in srcset attributes. For those reasons I think we can close this issue.

from wp-tevko-responsive-images.

lmartins avatar lmartins commented on June 13, 2024

Thanks for the info Joe, but just to make this clear, does Photon makes this plugin redundant and they should not be used in conjunction?

from wp-tevko-responsive-images.

joemcgill avatar joemcgill commented on June 13, 2024

In some ways, it seems that way, yes. In the mean time, I wouldn't recommend using them together since Photon is generating optimized image sizes for you on the fly. I'll keep my eye on this issue and will update it with any best practices we learn.

from wp-tevko-responsive-images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.