Drupal Feeds 从图像服务导入图像

Drupal Feeds Import Image from image service

我正在使用 Drupal 7 和 Feeds 将图像字段导入到内容类型的文章中,当图像 url 直接 link 到图像时它确实有效。

但是link发送到图像处理程序的图像:http://business.iafrica.com/apps/imageUtil/view/article/1008937/1/630x385/未导入。

我试过:

这是我的源供稿 url http://resource.thumbtribe.mobi/ds1.portal/portal/1/4/resource/view/maximized/9500187?format=atom_extern

我的图片:URI xpath 映射是:string(link[@rel="enclosure"]/@href)

我设法通过使用带有以下 php 片段的 feeds 篡改模块来保存图像,然后引用我服务器上的路径来解决这个问题。

$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;
}