How to add a CSS class to an render array? In a template file, before print render($content['field_image']); I would like to add a CSS class to the image in the $content['field_image'] render array. How can I do this?
Here is the render array:

Array
(
[#theme] =&gt; field
[#weight] =&gt; 2
[#title] =&gt; Image
[#access] =&gt; 1
[#label_display] =&gt; hidden
[#view_mode] =&gt; full
[#language] =&gt; und
[#field_name] =&gt; field_image
[#field_type] =&gt; image
[#field_translatable] =&gt; 1
[#entity_type] =&gt; node
[#bundle] =&gt; ll_basic_page
[#object] =&gt; stdClass Object
[#items] =&gt; Array
    (
        [0] =&gt; Array
            (
                [fid] =&gt; 6777
                [alt] =&gt; alt text
                [title] =&gt; 
                [uid] =&gt; 1
                [filename] =&gt; imageFile.jpg
                [uri] =&gt; public://imageFile.jpg
                [filemime] =&gt; image/jpeg
                [filesize] =&gt; 28742
                [status] =&gt; 1
                [timestamp] =&gt; 1314312382
                [rdf_mapping] =&gt; Array
                    (
                    )
            )
    )
[#formatter] =&gt; image
[0] =&gt; Array
    (
        [#theme] =&gt; image_formatter
        [#item] =&gt; Array
            (
                [fid] =&gt; 6777
                [alt] =&gt; alt text
                [title] =&gt; 
                [uid] =&gt; 1
                [filename] =&gt; imageFile.jpg
                [uri] =&gt; public://imageFile.jpg
                [filemime] =&gt; image/jpeg
                [filesize] =&gt; 28742
                [status] =&gt; 1
                [timestamp] =&gt; 1314312382
                [rdf_mapping] =&gt; Array ()
            )
        [#image_style] =&gt; 
        [#path] =&gt; 
    )
)


And this is the HTML output:

&lt;div class="field field-name-field-image field-type-image field-label-hidden" thmr="thmr_96"&gt;
  &lt;div class="field-items"&gt;
    &lt;div class="field-item even"&gt;
      &lt;span thmr="thmr_97"&gt;
        &lt;span thmr="thmr_98"&gt;
          &lt;img typeof="foaf:Image" src="http://..../sites/default/files/imageFile.jpg" alt="alt text" /&gt;
        &lt;/span&gt;
      &lt;/span&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


I tried adding a class to $content['field_image']['#attributes']['class'], but that didn't work.
Do you have any idea on how I can achieve what I am trying to do?
I believe it would be:

$content['field_image'][0]['#attributes']['class'][] = 'my-class';


Or to assign it to every element,

foreach (element_children($content['field_image'] as $key) {
  $content['field_image'][$key]['#attributes']['class'][] = 'my-class';
}