Merge branch 'master' into firebase-sample
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# Flickr is an image hosting and video
|
||||
# hosting website, and web services suite
|
||||
#
|
||||
# This example uses a third-party ruby library to authenticate a user
|
||||
# and output the most recent photo.
|
||||
#
|
||||
# Please see these for more information:
|
||||
#
|
||||
# https://www.flickr.com/services/developer
|
||||
# https://github.com/hanklords/flickraw
|
||||
|
||||
require 'flickraw'
|
||||
|
||||
FlickRaw.api_key="YOUR_API_KEY"
|
||||
FlickRaw.shared_secret="YOUR_APP_SECRET"
|
||||
|
||||
list = flickr.photos.getRecent
|
||||
|
||||
id = list[0].id
|
||||
secret = list[0].secret
|
||||
info = flickr.photos.getInfo :photo_id => id, :secret => secret
|
||||
|
||||
puts info.title
|
||||
puts info.dates.taken
|
||||
|
||||
sizes = flickr.photos.getSizes :photo_id => id
|
||||
|
||||
original = sizes.find {|s| s.label == 'Original' }
|
||||
puts original.width
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
# Instagram is an online mobile photo-sharing,
|
||||
# video-sharing and social networking service that
|
||||
# enables its users to take pictures and videos,
|
||||
# and share them on a variety of social networking platforms.
|
||||
#
|
||||
# This example uses a third-party PHP library to authenticate a user
|
||||
# and to output the most popular media.
|
||||
#
|
||||
# Please see these for more information:
|
||||
#
|
||||
# http://instagram.com/developer/
|
||||
# https://github.com/cosenary/Instagram-PHP-API
|
||||
|
||||
require_once 'Instagram.php';
|
||||
use MetzWeb\Instagram\Instagram;
|
||||
|
||||
$instagram = new Instagram(array(
|
||||
'apiKey' => 'YOUR_APP_KEY',
|
||||
'apiSecret' => 'YOUR_APP_SECRET',
|
||||
'apiCallback' => 'YOUR_APP_CALLBACK'
|
||||
));
|
||||
|
||||
$result = $instagram->getPopularMedia();
|
||||
|
||||
foreach ($result->data as $media) {
|
||||
$content = "<li>";
|
||||
// output media
|
||||
if ($media->type === 'video') {
|
||||
// video
|
||||
$poster = $media->images->low_resolution->url;
|
||||
$source = $media->videos->standard_resolution->url;
|
||||
$content .= '<video width="250" height="250" poster="' . $poster . '"
|
||||
data-setup="{"controls":true, "preload": "auto"}">
|
||||
<source src="' . $source . '" type="video/mp4" />
|
||||
</video>';
|
||||
} else {
|
||||
// image
|
||||
$image = $media->images->low_resolution->url;
|
||||
$content .= '<img class="media" src="' . $image . '"/>';
|
||||
}
|
||||
// create meta section
|
||||
$avatar = $media->user->profile_picture;
|
||||
$username = $media->user->username;
|
||||
$comment = (!empty($media->caption->text)) ? $media->caption->text : '';
|
||||
$content .= '<div class="content">
|
||||
<div class="avatar" style="background-image: url(' . $avatar . ')"></div>
|
||||
<p>' . $username . '</p>
|
||||
<div class="comment">' . $comment . '</div>
|
||||
</div>';
|
||||
// output media
|
||||
echo $content . "</li>";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user