在drupal中获取图像路径

时间:2013-12-24 07:48:39

标签: drupal-7 drupal-services

可能是这个问题早先被问过,但我还没有找到合适的答案。我有图像uri路径,我想在drupal中创建一个Web服务。从android当我调用这个webservices我将发送uri然后我想得到图像网址将返回我我的自定义图像样式网址。但是当我传递带有文件扩展名的网址时,我会Could not find the Controller 这是我的函数,它将返回图像的URL:

 'image_url' => array('operations' => array('retrieve' => array(
      'help' => t('The resource to retrive the image of the given url/uri.'),
      'callback' => '_fieldinsync_image_url_retrieve',
      'args' => array(
          array(
                'name' => 'url',
                'optional' => FALSE,
                'source' => array('path' => 'url'),
                'type' => 'string',
                'description' => 'The url/uri of the image.',
         )),
      'access callback' => 'services_access_menu',
    ),),),

功能:

function _fieldinsync_image_url_retrieve($imgUrl){

  $value;
  $value[]=array(
  'vname'=> 'session_id',
  'sname' => 'session_name');
   $value['uri'] = image_style_url('mobile_product_image', $imgUrl);

return $value;
 }

Uri是:public://Tab - A2107.jpg

1 个答案:

答案 0 :(得分:1)

得到了我的答案

需要在settings.php中添加这些行

$conf['image_allow_insecure_derivatives'] = TRUE;
相关问题