Adding Bootstrap's img-responsive class to all site images.
Get raw version
php
/** * Image Preprocesses * Adds bootstrap class to all images */ function yourTheme_preprocess_image(&$vars) { $vars['attributes']['class'][] = 'img-responsive'; // This test is for images that are displayed in 'original' format. // http://getbootstrap.com/css/#overview-responsive-images } function yourTheme_preprocess_image_style(&$vars) { $vars['attributes']['class'][] = 'img-responsive'; // This test is for images that have an image style or format applyed. // http://getbootstrap.com/css/#overview-responsive-images }