tevko / wp-tevko-responsive-images Goto Github PK
View Code? Open in Web Editor NEWFully responsive image plugin for wordpress
Fully responsive image plugin for wordpress
It would be great if this also added support for Retina / HiDPI images.
I realized something is messed up on my server to cause the absence of 'sizes' coming from wp_get_attachment_metadata ($id ); but either way, I'm getting this error:
NOTICE: wp-content/plugins/ricg-responsive-images/wp-tevko-responsive-images.php:165 - Undefined index: sizes
Would it be possible to change your line 165 to:
$img_sizes = isset($img_meta['sizes']) ? $img_meta['sizes'] : array();
Since 'full' is immediately added and the next loop runs through available sizes set, this wouldn't be too big of a hit to the whole system - only help to pad a a potential error from dirty data.
Thanks in advance for your consideration.
@chriscoyier , I put together a pen http://codepen.io/tevko/pen/tlFBJ in an effort to understand the srcset syntax. From what I understand, this code is telling the browser that it has a full width image (100vw) and three possible sizes to choose from. It's also letting the browser know that it has three breakpoints as well.
Here's where I'm having difficulties.
1st up, (and I don't know if this is picturefill, the browser, or me causing this problem), the browser almost always loads 2 images on page load. first it loads the largest image, then it loads the correct one as defined by the srcset syntax. Relevant image:
2nd, lets define a use case in which an iphone 5s, 6, 6plus, 9000 etc. is loading a page, but they have a poor network connection. Where it would make sense to serve the user a lower quality image, the srcset syntax will force the browser to serve the user an image that works best with their screen resolution. It seems that srcset doesn't have a use case for high dpi screens with poor network connections. Am I understanding this correctly?
I'm getting WP warning in debug mode and :
<img srcset="Array" alt="">
wp-tevko-responsive-images.php line 66, seems wp_get_attachment_url returns an array. I just updated line 66 to:
<img srcset="' . wp_get_attachment_image_src( $imageid )[0] . '" alt="' . tevkori_get_img_alt( $imageid ) . '">
Running Wordpress 3.9.1.
Thanks for sharing this great script!
One of the primary reasons to use <picture>
is having entirely different images being swapped out depending on the circumstances (art direction).
In the case of this plugin, the images are auto-generated re-sizings, which is a better fit for srcset
.
http://codepen.io/anon/pen/eIcKz
https://twitter.com/yoavweiss/status/478648919917068288
http://scottjehl.github.io/picturefill/
It's a little weird to me still, because obviously picture CAN be used for this, and you CAN do art direction with srcset as well, sooooo. ¯_(ツ)_/¯
This could just be something only I am seeing, but the srcset
and alt
attributes in the fallback image are blank. I have a fix - let me know if you want a PR.
this merge was lost in the update to picturefill 2.0 - #3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.