Git Product home page Git Product logo

instagram-kirby-plugin's Introduction

Instagram Plugin for Kirby by Simon Albrecht (1.0.1)

This is a plugin for Kirby that loads images from the Instagram API.

Installation

  1. Put the instagram.php file in your site/plugins folder. If this folder doesn't exist yet, create it.
  2. In order to interact with the Instagram API, you need to obtain an access token for yourself.
  3. Visit http://instagr.am/developer/client/register/ and register an application.
  4. Copy the Client-ID of the newly created app.
  5. Visit https://instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=http://d.pr/ZO1g&response_type=token in your browser, but replace CLIENT-ID with your client-id. Note The callback-url points to a simple (open source) tool I wrote for better display of the params passed to a callback url.
  6. Copy the access token and/or save it somewhere.
  7. Implement the plugin into your template.

Update instructions

To update, just replace the old instagram.php file in site/plugins, with the new one.

Example usage

<?php
// Load an instagram object using your access_token (see installation)
// containing 10 shots.
// Note: Replace XXX… with your access_token
$instagram  = instagram('XXX.XXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXX', 10);
$images	    = $instagram->images();

foreach ($images as $image): ?>
    <div class="instagram-photo">
        <a href="<?php echo $image->link ?>"><img src="<?php echo $image->url ?>" /></a>
        <div class="location">
            <span>
                <?php echo $image->location ?> (<?php echo $image->latitude ?>, <?php echo $image->longitude ?>)
            </span>
        </div>
    </div>
<?php endforeach ?>

Advanced Users: See the source for further options.

Attributes for the image

  • $image->link The link to the image
  • $image->comments The number of comments
  • $image->likes The number of likes
  • $image->created The timestamp when the image was created
  • $image->thumb The url of the thumbnail of the image
  • $image->url The url of the full-sized image
  • $image->image_lowres The url to a low-res version of the image
  • $image->filter The filter that was used
  • $image->location The location name
  • $image->latitude The latitude of the location
  • $image->longitude The longitude of the location
  • $image->tags An array of tags of the image

Attributes for the user-object

  • $user->username The username of the user
  • $user->full_name The full name of the user
  • $user->picture The url to the avatar of the user

Requirements

Your web server must have support for cURL (installation instructions).

Author

Copyright 2012, Simon Albrecht http://albrecht.me/. If you use this plugin, feel free to ping me @s_albrecht.

instagram-kirby-plugin's People

Contributors

simonalbrecht avatar

Watchers

Archie Jereos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.