How does this module compare with the Picture and breakpoints duo. How to we provide the image sizes - would it use the sizes defined by us in core-image styles (smallest to largest image styles)? Do we need to make exactly the same number of image styles as named queries defined in interchange as shown on http://foundation.zurb.com/docs/v/4.3.2/components/interchange.html ? How does it deal with landscape and portrait media queries as defined in foundation4? What about performance when compared to picture?

Comments

kevinquillen’s picture

You only have to provide the original size image, and image cache will generate the derivatives. Interchange will swap between the image cache URLs as the browser resizes, or loaded at a particular breakpoint width (mobile devices). So, just 1 image is all you provide.

You can have as many or as few styles as you want. The caveat is the style names need to match the Interchange ones (Small, Medium, Large), and the custom ones you want to add have to be added as an extension via Javascript, like so (from the docs):

$(document).foundation('interchange', {
  named_queries : {
    my_custom_query : 'only screen and (max-width: 200px)'
  }
});

So, in your theme template.php, you could do something like:

function mytheme_themehook($args) {
  drupal_add_js('jQuery(document).foundation("interchange", {
      named_queries : {
        my_custom_query : 'only screen and (max-width: 200px)'
      }
    });',
    array('type' => 'inline', 'scope' => 'footer', 'weight' => 1000)
  );
}

If you use Interchange on lots of pages, it may be best suited in a preprocess_page hook. With that, you can define dozens of custom named queries, again, all the image cache style names need to match up to them so the module can sync them up when rendering.

kevinquillen’s picture

Status: Active » Closed (works as designed)