Skip to content

Sam's blog

Frontend Software Engineer

Category: Boostrap

Drupal: How to apply the img-responsive class to all images in your bootstrap subtheme

UPDATE: This is now included by default and should not be used.

In your subtheme’s template.php file, add the following:

function YOURTHEMENAME_preprocess_image(&$vars)
{
    $vars['attributes']['class'][] = 'img-responsive';
    // http://getbootstrap.com/css/#overview-responsive-images
}
Published September 17, 2015
Categorized as Boostrap, Drupal

Recent Posts

  • How to improve the performance of your Axios API requests
  • How to finish your MVP in a weekend.
  • How to set PHP memory limit and max execution time in your Dockerfile
  • Modify Search API sort order in Drupal using a hook
  • How to use a relative path to your JS and CSS in Drupal 7

Recent Comments

  • Reachfar Gps on RF-V16 GPS Tracker
  • Jenny Lam on RF-V16 GPS Tracker
  • Mark Smith on RF-V16 GPS Tracker
  • Junior on RF-V16 GPS Tracker
  • João Fonseca on RF-V16 GPS Tracker

Archives

  • December 2024
  • June 2020
  • August 2019
  • November 2018
  • October 2018
  • May 2018
  • November 2017
  • September 2017
  • August 2017
  • July 2017
  • May 2017
  • April 2017
  • March 2017
  • January 2017
  • July 2016
  • May 2016
  • March 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • February 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014

Categories

  • Adobe CQ
  • Agile
  • AMP
  • Apartments
  • Apple
  • Axios
  • Backgrid.js
  • Boostrap
  • CKEditor
  • Curata
  • Disqus
  • Docker
  • Drones
  • Drupal
  • Exact Target
  • GPS
  • Javascript
  • MVP
  • Parenting
  • Parse.com
  • PHP
  • Postgres
  • React
  • RSS
  • Salesforce
  • Scrum
  • SSL
  • SSO
  • TypeScript
Sam’s blog
Proudly powered by WordPress.