From 517dcca99a088d786c9279e6a9da2c838220df73 Mon Sep 17 00:00:00 2001 From: Jamie Shields Date: Tue, 20 Oct 2015 10:58:08 +0100 Subject: [PATCH 1/2] Enable pagination for getTagMedia() function Add max_tag_id parameter to enable paginating the API resultset beyond the initial limit. --- src/Instagram.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Instagram.php b/src/Instagram.php index 1fb70f2..92d5323 100644 --- a/src/Instagram.php +++ b/src/Instagram.php @@ -375,16 +375,21 @@ public function getTag($name) * * @param string $name Valid tag name * @param int $limit Limit of returned results + * @param integer $max_tag_id Max ID to return (for pagination) * * @return mixed */ - public function getTagMedia($name, $limit = 0) + public function getTagMedia($name, $limit = 0, $max_tag_id = 0) { $params = array(); if ($limit > 0) { $params['count'] = $limit; } + + if($max_tag_id > 0) { + $params['max_tag_id'] = $max_tag_id; + } return $this->_makeCall('tags/' . $name . '/media/recent', false, $params); } From bc3cb24380d0c480ca1d1c4109632115d34e056e Mon Sep 17 00:00:00 2001 From: Jamie Shields Date: Tue, 20 Oct 2015 11:01:11 +0100 Subject: [PATCH 2/2] Style check change --- src/Instagram.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Instagram.php b/src/Instagram.php index 92d5323..469e276 100644 --- a/src/Instagram.php +++ b/src/Instagram.php @@ -387,7 +387,7 @@ public function getTagMedia($name, $limit = 0, $max_tag_id = 0) $params['count'] = $limit; } - if($max_tag_id > 0) { + if ($max_tag_id > 0) { $params['max_tag_id'] = $max_tag_id; }