How to import image using Feeds which doesn't have a correct file extension? I am using Drupal 7 and Feeds to import an image field into a content type article and it does work when the image URL is a direct link to the image.

However images that are linked to image handlers, like:


  http://business.iafrica.com/apps/imageUtil/view/article/1008937/1/630x385/


are not importing.

I have tried:


to use the Feeds Tamper module and Feeds Tamper PHP and alter the image name, but this resulted in an invalid URL loading,
to use Field Image Grabber, but I have an XML source, not HTML.


Here is my source feed URL:


  http://resource.thumbtribe.mobi/ds1.portal/portal/1/4/resource/view/maximized/9500187?format=atom_extern


and my Image: URI XPath mapping is:

string(link[@rel="enclosure"]/@href)
I managed to solve this by using the feeds tamper module with the following php snippet to save the image and then reference the path on my server.

$checkext = substr($field, -5);

if (strpos($checkext,'.') == false)
{
  $filename = str_replace(".","_",microtime(true)).".jpg";
  $output = "public://field/image/".$filename;
  file_put_contents($output, file_get_contents($field));
  return  $output;
}
else
{
  return $field;
}