armando_e,
I’m not one of the developers, and cannot answer your question (you’ll have to wait for someone else to do that for you). But since you know how to code, I thought I’d give you three links that you might find useful:
1. This Plugin’s Merge Proposal for WordPress Core: https://make.ww.wp.xz.cn/core/2015/09/30/responsive-images-merge-proposal/.
2. The Initial Core Patch Offered: https://core.trac.ww.wp.xz.cn/ticket/33641.
3. The Initial Core Commit which will show up in WordPress 4.4:
https://core.trac.ww.wp.xz.cn/changeset/34855.
With your skills, you might be able to help contribute to the core merge or comment on its continued development as a plugin until that time.
Hi armando_e,
The height and width parameters that you see in other examples are usually coming from WordPress, and not from our plugin. You can manually add those attributes yourself, or you can use a function like wp_get_attachment_image_src() to get the image url, height, and width before creating your image tag.
That said, if you use wp_get_attachement_image( $the_id, 'large' ) you’ll get the full img element including srcset and sizes without the need to write out any of the HTML yourself.
Hope this helps.
Thank you both for this information. Joe, if I get the width/height using wp_get_attachment_image_src(), will that return the full largest size or will it return the current size (like medium)? My goal is to implement this with Masonry and Lazy Load, which can trigger the layout if each element has a width and height, otherwise, I would have to wait for images to load before i can fire Masonry/Lazy Loading.
Thanks again for your speedy support replies and wonderful plugin.
Hey Armando,
Sorry for the delay. The function you mention, wp_get_attachment_image_src() will still return the current size. For lazy loading, you may want to take a look at aFarkas lazysizes code: https://github.com/aFarkas/lazysizes
He has a WordPress plugin as well, but I think it may be outdated.
Joe