Giter Club home page Giter Club logo

yii2-instagram-widget's Introduction

Yii2 Instagram Widget

Yii2 Instagram Widget allows you to show your Instagram Photos on your Yii Framework 2 based Website.

This widget is based on inwidget by aik27 and use cosenary's PHP wrapper for the Instagram API.

Example

The Widget is available in Russian and English translations (depends on language configuration of application)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist kmarenov/yii2-instagram-widget "*"

or add

"kmarenov/yii2-instagram-widget": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId' => '<your-instagram-client-id>',
        'userName' => 'shnurovs'
    ]);
?>

You must put your Instagram Client Id to 'clientId' option.

How to get Instagram Client Id:

  1. Go to the Instagram developer website
  2. Register your application
  3. You are now presented with a Client ID

Yii2 Instagram Widget can show photos by Instagram Username or by Hashtag.

if you want to get photos by tag then use this code :

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId' => '<your-instagram-client-id>',
        'tag' => 'cat'
    ]);
?>

Widget Options

  • clientId : Your Instagram Client Id
  • userName : Instagram Username of the user whose photos You want to show
  • tag : Hashtag if You want to show photos by tag
  • showBy : (user or tag) If userName and tag options are set both, You can select how to show photos: by username or by hashtag
  • isCacheEnabled : (true or false) Enable cashing (default: true)
  • cacheTime : Cache lifetime (default: 3600 = 1 hour)
  • width : Widget width in pixels (default: 260)
  • imgWidth : Width of one image in pixels (default: 0 = calculated automatically)
  • inline : Count of image at one row (default: 4)
  • isShowToolbar : (true or false) Show or hide Toolbar (default: true)
  • count : Total count of showed images (default: 12)
  • imgRes : (low_resolution - 320x320, thumbnail - 150x150, standard_resolution - 640x640) Resolution of images (default: thumbnail)

Warning: Because the Instagram API has a limit of requests count for a day, then enable caching is strongly recommended!

Examples

By default

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId' => '<your-instagram-client-id>',
        'userName' => 'shnurovs'
    ]);
?>

Example

Without toolbar

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId'      => '<your-instagram-client-id>',
        'userName'      => 'shnurovs',
        'isShowToolbar' => false
    ]);
?>

Without toolbar

Mini

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId'      => '<your-instagram-client-id>',
        'userName'      => 'shnurovs',
        'isShowToolbar' => false,
        'width'         => 100,
        'inline'        => 2
    ]);
?>

Mini

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId'      => '<your-instagram-client-id>',
        'userName'      => 'shnurovs',
        'isShowToolbar' => false,
        'width'         => 100,
        'inline'        => 1,
        'count'         => 3
    ]);
?>

Mini

Horisontal

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId'      => '<your-instagram-client-id>',
        'userName'      => 'shnurovs',
        'isShowToolbar' => false,
        'width'         => 800,
        'inline'        => 7,
        'count'         => 14
    ]);
?>

Horisontal

Big previews

<?= \kmarenov\instagram\InstagramWidget::widget([
        'clientId'      => '<your-instagram-client-id>',
        'userName'      => 'shnurovs',
        'isShowToolbar' => false,
        'width'         => 800,
        'inline'        => 3,
        'count'         => 9,
        'imgRes'        => 'low_resolution'
    ]);
?>

Big previews

yii2-instagram-widget's People

Contributors

kmarenov avatar

Watchers

James Cloos avatar Sergey Bunevich 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.