Using setAttributes() returns a fatal error
The error is simply caused from the fact you are trying to access a member function for something that is an object; in fact, theme_image_style() is returning a string, not an object. This is true also for Drupal 8.


  Returns HTML for an image using a specific image style.


To set attributes, just use the following code.

$imgpath = file_load(($node-&gt;field_image[LANGUAGE_NONE][0]['fid']))-&gt;uri;
$image = theme('image_style', array('path' =&gt; $imgpath, 'style_name' =&gt; 'thumbnail', 'attributes' =&gt; array('class' =&gt; array('AnyClass'))));

$link = l($image, "node/$node-&gt;nid", array('html' =&gt; TRUE));
print $link;


It works because theme_image_style(), as theme_image(), accepts a list of attributes to add to the image tag.