如何在一个请求中从 cloudinary 接收带有标签的资源

How to receive resources with tags from cloudinary in one request

我的图片库是根据 Cloudinary 的请求创建的。

$api = new \App\cloudinaryGallery;
$api->resources();

Response {#176 ▼
  +"rate_limit_reset_at": 1477141200
  +"rate_limit_allowed": 500
  +"rate_limit_remaining": 499
  flag::STD_PROP_LIST: false
  flag::ARRAY_AS_PROPS: false
  iteratorClass: "ArrayIterator"
  storage: array:2 [▼
    "resources" => array:10 [▼
      0 => array:11 [▼
        "public_id" => "tiltkomp/gallery/kreoart"
        "format" => "jpg"
        "version" => 1477075563
        "resource_type" => "image"
        "type" => "upload"
        "created_at" => "2016-10-21T18:46:03Z"
        "bytes" => 1766084
        "width" => 1920
        "height" => 2607
        "url" => "http://res.cloudinary.com/djxgexgng/image/upload/***************/tiltkomp/gallery/kreoart.jpg"
        "secure_url" => "https://res.cloudinary.com/djxgexgng/image/upload/***************/tiltkomp/gallery/kreoart.jpg"
      ]
      1 => array:11 [▶]
      2 => array:11 [▶]
      3 => array:11 [▶]
      4 => array:11 [▶]
      5 => array:11 [▶]
      6 => array:11 [▶]
      7 => array:11 [▶]
      8 => array:11 [▶]
      9 => array:11 [▶]
    ]
  ]
}

在请求中 table 没有关于标签的信息。要接收标签信息,我必须为每张图片循环发送请求

foreach ($pictures['resources'] as $pic) {
    $path_part = pathinfo($pic['url']);
    $tags = $api->resource($api->path . $path_part['filename']);    
    $picturesName[basename($pic['url'])] = $tags;
}

并收到:

Response {#178 ▼
  +"rate_limit_reset_at": 1477141200
  +"rate_limit_allowed": 500
  +"rate_limit_remaining": 497
  flag::STD_PROP_LIST: false
  flag::ARRAY_AS_PROPS: false
  iteratorClass: "ArrayIterator"
  storage: array:14 [▼
    "public_id" => "tiltkomp/gallery/bodnar"
    "format" => "jpg"
    "version" => 1477075543
    "resource_type" => "image"
    "type" => "upload"
    "created_at" => "2016-10-21T18:45:43Z"
    "bytes" => 976947
    "width" => 1920
    "height" => 1489
    "url" => "http://res.cloudinary.com/djxgexgng/image/upload/***************/tiltkomp/gallery/bodnar.jpg"
    "secure_url" => "https://res.cloudinary.com/djxgexgng/image/upload/***************/tiltkomp/gallery/bodnar.jpg"
    "tags" => array:2 [▼
      0 => "all"
      1 => "shop"
    ]
    "derived" => array:4 [▶]
  ]
}

怎么做比较有效?是否可以在一次请求中接收图片和标签的信息?

以下将包含标签作为批量列表方法响应的一部分:

$api->resources(array("tags" => TRUE));