Custom feed tamper plugin to convert an image GUID into a URI I have a feed importer for image files, which stores a column in my source csv as the GUID of the final files in Drupal.

I also have another importer for, say, articles. In the articles csv, there is an "image key" column, that corresponds to the image GUIDs mentioned above.

I'm working on a custom feeds tamper plugin that can convert the GUIDs to the image URIs that have already been imported by the first importer, but I'm completely lost on how to retrieve the images in the code.

So, the question is: how do I convert an previously imported image file GUID into the actual image's URI?
I came up with a solution, simply using a DB query to get what I want. Here is the callback for the tamper module. Hopefully someone will find a better solution, if it's possible.

function myfeedsmodule_tamper_imagekey_callback($result, $item_key, $element_key, &amp;$field, $settings) {
  $field = trim($field);
  if ($field == 'NULL') {
      $field = NULL;
      return;
  }
  $result = db_select('feeds_item', 'f')
          -&gt;fields('f', array('entity_id'))
          -&gt;condition('guid', $field, '=')
          -&gt;condition('entity_type', 'file', '=')
          -&gt;condition('id', 'my_image_importer', '=')
          -&gt;execute()
          -&gt;fetchField();
  if (!$result) {
      $field = NULL;
      return;
  }
  $entities = entity_load('file', array($result));
  if (!$entities) {
      $field = NULL;
      return;
  }
  $image = current($entities);
  $field = $image-&gt;uri;
}