How to add css using the Preprocess_image function? I'm trying to preprocess my image style like this example 

&lt;img class="media-object img-rounded img-responsive"  src="http://placehold.it/350x250"&gt;

My preprocess_image function looks like so:

function bootstrap_subtheme_preprocess_image(&amp;$variables) {
  if(isset($variables['style_name'])) {
    if($variables['style_name'] == 'logged-in') {
      $variables['attributes']['class'][] = "media-object";
      $variables['attributes']['class'][] = "img-responsive";
      $variables['attributes']['class'][] = "img-rounded";
    }
  }
}


But it is not adding the classes.

Why not?
Try this. 

function mytheme_preprocess_image(&amp;$variables) {
   if(isset($variables['style_name'])) {
    if($variables['style_name'] == 'image_style') // this is an image style used in drupal's image styles {
     $variables['class']['img-responsive'][] = "true";
  }
 }
}