1
我的圖片庫是在Cloudinary請求後創建的。如何在一個請求中接收來自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 [▶]
]
]
}
請求表中沒有關於標籤的信息。要接收標籤的信息,我不得不在循環發送請求,對每個畫面
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 [▶]
]
}
怎麼做更有效?是在一個請求中接收有關圖片和標籤的信息的方式嗎?