Conditionally change the image field style and wrapping it in a div
You can set wrapper for it with simple way
instead 

print render($content);     

just use     

print '&lt;div class="my-wrapper"&gt;'.render($content['field_image']).'&lt;/div&gt;;

and for second limitation if you have not $node just need load it with node_load  ( if you have nid)

So before your code 

  $node= node_load($nid);