【问题标题】:Drupal Feeds Import Image from image serviceDrupal Feeds 从图像服务导入图像
【发布时间】:2015-10-18 09:05:34
【问题描述】:

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

但是链接到图像处理程序的图像:http://business.iafrica.com/apps/imageUtil/view/article/1008937/1/630x385/没有导入。

我试过了:

  • 要使用 Feeds Tamper Module 和 Feeds Tamper PHP 来尝试更改图像名称,这 导致无效的 URL 加载。
  • 要使用 Field Image Grabber,但我有一个 XML 源,而不是 HTML。

这是我的源提要网址http://resource.thumbtribe.mobi/ds1.portal/portal/1/4/resource/view/maximized/9500187?format=atom_extern

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

【问题讨论】:

    标签: drupal drupal-feeds


    【解决方案1】:

    我设法解决了这个问题,方法是使用带有以下 php sn-p 的提要篡改模块来保存图像,然后引用我服务器上的路径。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-19
      • 1970-01-01
      • 2020-01-05
      • 2012-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-16
      相关资源
      最近更新 更多