Ejemplo n.º 1
0
 echo $content . '</li></ul>';
 echo "<ol>";
 $counttags = count($media->tags);
 $limit = floor(100 / $counttags);
 echo "limit {$limit}; counttags {$counttags}<br>";
 foreach ($media->tags as $tag) {
     echo "<li><h3 style='text-align:center'>{$tag}</h3><ul class=\"grid\">";
     $tagnewmedia = $instagram->getTagMedia($tag);
     $x = 0;
     foreach ($tagnewmedia->data as $tagmedia) {
         $x++;
         if ($x == $limit) {
             break;
         } else {
             $mediaid = $tagmedia->id;
             $likedresult = $instagram->likeMedia($mediaid);
             if ($likedresult->meta->code === 200) {
                 $content = '<li class="li" id="' . $mediaid . '">';
                 // output media
                 if ($tagmedia->type === 'video') {
                     // video
                     $poster = $tagmedia->images->low_resolution->url;
                     $source = $tagmedia->videos->standard_resolution->url;
                     $content .= "<video class=\"media video-js vjs-default-skin\" width=\"250\" height=\"250\" poster=\"{$poster}\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tdata-setup='{\"controls\":true, \"preload\": \"auto\"}'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<source src=\"{$source}\" type=\"video/mp4\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t</video>";
                 } else {
                     // image
                     $image = $tagmedia->images->low_resolution->url;
                     $content .= "<img class=\"media\" src=\"{$image}\"/>";
                 }
                 // create meta section
                 $avatar = $tagmedia->user->profile_picture;