Responsive image

Modern web designs need to take into account the device that is being used to view the content that Drupal is presenting. Different devices have different form factors from mobile phones, to tables, to traditional desktop computers. You may have heard of the terms 'Responsive design' or 'Adaptive design', and basically these mean that rather than having a different mobile version of your site for a mobile device, the content display is modified automatically depending on the device being used.

The following are examples of how content may be presented differently:

  • Show smaller images on a mobile device to conserve mobile data bandwidth.
  • Rearrange template regions to best present the most important information on a small screen size.

Responsive design relies on a concept known as a breakpoint. This can be thought of as the width of the screen in pixels where the design changes to a layout more appropriate for that device.

In the default theme Bartik, there are three breakpoints defined (which is a common starting point in responsive design)–mobile, narrow, and wide. You could also think of these as mobile, tablet portrait, and desktop.

The Responsive image module allows you to add some simple mobile optimization to your website.

Enable the Responsive image module now.

When activated, a new configuration screen will be available on the Configuration page.

Locate the MEDIA section and click on Responsive image styles:

Responsive image

You will see two pre-defined responsive image styles:

Responsive image

We won't go into detail here on how to create and configure new responsive styles because that would involve too lengthy a discussion involving technical responsive design terminology.

You've already got the two pre-defined ones: Narrow and Wide so instead we'll simply employ those to kick in for your Article content type at the existing breakpoints.

Go to the Manage display page of the Article content type by navigating to:

Structure | Content Types | Article | Manage display (admin/structure/types/manage/article/display).

Note again that since we opted to customize the Full content view mode:

Responsive image

When you select the FORMAT of the Image field, you will see there are now a two additional ones: Responsive image option. Select this option:

Responsive image

Once you have selected this, click on the gear icon to choose the required Responsive image for use within this view mode:

Responsive image

Tip

If you use some quite distinct image styles it should be easier to spot the difference between the three breakpoints by resizing your browser window. Just bear in mind that only up-to-date browsers support this feature.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset