For a Drupal 7 project I use the image and assets management module Scald. I find the handling of module rather comfortable: it lets the editor choose so called media atom from a media pool and insert them into CKEditor either by drag’n’drop, or by using the ‘insert’ funtionality of Scald.
The module comes along with a field – the Atom Reference – which half works like an image field, half like an Entity Reference field. But finding the actualy image path first was a bit tricky: when printing the node array, you’ll just get the SID for the referenced image, but no details – they’re loaded through the scald function ‘scald_atom_load’.
This gets the SID from the node’s array:
$img = $vars['node']->field_teaser_image['und']['sid'];
SImilar to ‘entity_load’ this fetches the atom reference’s object:
$atom = scald_atom_load($img);
This is how I then load the title of the atom reference image inside template.php:
$vars['img_title'] = $atom->title;
And the actual filename is inside another object base_entity:
$vars['img_filename'] = $atom->base_entity->filename;
Found the solutions through this scald issue. Took me a while – hope this may help somebody else some day.