How to get the Object based on File ID (FID) I'm inside mytheme_image_formatter($variables) function and I got the image's FID (from $fid = $variables['item']['fid']).

Question:
Is there a way to know which object is using the image file?

Using file_usage_list(file_load($fid)), I can see which objects may use the file. But I want to know which one is using the image file, inside my function.

Tried to use mytheme_preprocess_image(&amp;$variables), but I also found the same situation.

This is the same problem as discussed here, without a solution.

Thanks
You can use an EntityFieldQuery, e.g.

$field_name = 'field_something';
$fid = 123;

$query = new \EntityFieldQuery();
$query-&gt;entityCondition('node')
  -&gt;propertyCondition('type', 'the_type')
  -&gt;fieldCondition($field_name, 'fid', $fid);

$results = $query-&gt;execute();
if (!empty($results['node'])) {
  $nodes = node_load_multiple(array_keys($results['node']));

  // $nodes contains all nodes that reference the given file via field_something.
}