newscoop/instagram-plugin-bundle

Newscoop的Instagram插件

安装: 20

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 16

分支: 1

公开问题: 0

类型:newscoop-plugin

dev-master 2014-10-28 16:14 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:37:09 UTC


README

此Newscoop插件添加了smarty函数和Admin工具,使您能够将Instagram照片导入、管理和显示在Newscoop中。

在OSX上的MAMP上安装Newscoop v4.3的说明

  1. php application/console plugin:install newscoop/instagram-plugin-bundle
  2. 编辑newscoop/application/configs/parameters/custom_parameters.yml文件(如果不存在则创建)并添加以下文本
parameters:
    instagram_bundle:
        client_id: "your client id"
        client_secret: "your client secret"
        baseurl: "https://api.instagram.com/v1/"
        max_count: 500
  1. 运行以下命令以从Instagram导入初始的500张照片
php application/console instagram_photos:ingest lennonwall

在OSX上的MAMP上更新Newscoop v4.3的说明

  1. php application/console plugin:remove newscoop/instagram-plugin-bundle
  2. 按照上面手动安装的步骤操作

Instagram照片查看

提供端点/instagram/photos/{id}以查看单个本地缓存的Instagram照片。加载模板Resources/views/Instagram/instagram_photo.tpl或如果存在于加载的主题中,则加载_views/instagram_photo.tpl

用法

<img src="{{ $instagramPhoto->getThumbnailUrl() }}" width="{{ $instagramPhoto->getThumbnailWidth() }}" height="{{ $instagramPhoto->getThumbnailHeight() }}">

<img src="{{ $instagramPhoto->getLowResolutionUrl() }}" width="{{ $instagramPhoto->getLowResolutionWidth() }}" height="{{ $instagramPhoto->getLowResolutionHeight() }}">

<img src="{{ $instagramPhoto->getStandardResolutionUrl() }}" width="{{ $instagramPhoto->getStandardResolutionWidth() }}" height="{{ $instagramPhoto->getStandardResolutionHeight() }}">

<p>Id: {{ $instagramPhoto->getId() }}</p>
<p>Link: {{ $instagramPhoto->getLink() }}</p>
<p>Caption: {{ $instagramPhoto->getCaption() }}</p>
<p>Tags: {{ $instagramPhoto->getTags() }}</p>
<p>Created by Instagram User: {{ $instagramPhoto->getInstagramUserName() }}</p>
<p>Created on: {{ $instagramPhoto->getCreatedAt()|date_format:"Y-m-d" }}</p>

Instagram照片搜索

请注意,这仅搜索本地存储的InstagramPhoto实体,它不会调用Instagram API

提供端点/instagram/photosearch,它接受以下参数

  1. search - 搜索字符串,与标题、用户名、标签和locationName字段匹配
  2. perPage - 每页要发送到结果中的记录数
  3. offset - 要开始的第一个记录(用于分页)

结果发送到定义在您的主题中的_views/instagram_search_results.tpl,如果没有定义,则使用默认内部视图。

用法

<div id="nav">
   <div class="left-nav"><a href="{{ $prevPageUrl }}">Previous</a></div>
   <div class="center-nav"><span>found {{ $instagramPhotoCount }} results</span></div>
   <div class="right-nav"><a href="{{ $nextPageUrl }}">Next</a></div>
</div>
<br class="clear">

<ul id="photo-results-container">
{{ foreach $instagramPhotos as $photo }}
    <li>
        <div id="box" style="background: url({{ $photo->getLowResolutionUrl() }})">
            <div id="overlay">
                <span id="plus">
                    Posted By: {{ $photo->getInstagramUserName() }}<br>
                    On: {{ $photo->getCreatedAt()|date_format:"Y-m-d" }}<br>
                    <br>
                    {{ $photo->getCaption() }}
                </span>
            </div>
        </div>
    </li>
{{ /foreach }}
</ul>

Instagram列表照片Smarty块

提供Smarty块以列出具有特定标签的Instagram照片。

用法

{{ list_instagram_photos tag='lennonwall'  length=30 }}
  <p>{{ $photoIndex }}</p>
  <p>{{ $photo->getCaption() }}</p>
  <p>{{ $photo->getCreatedAt() }}</p>
  <p>{{ $photo->getId() }}</p>
  <p>{{ $photo->getInstagramUserName() }}</p>
  <p>{{ $photo->getTags() }}</p>
  <p>{{ $photo->getLocationName() }}</p>
  <p>{{ $photo->getLocationLatitude() }}</p>
  <p>{{ $photo->getLocationLingitude() }}</p>
  <p>{{ $photo->getLink() }}</p>

  <p>{{ $photo->getThumbnailUrl() }}</p>
  <p>{{ $photo->getThumbnailWidth() }}</p>
  <p>{{ $photo->getThumbnailHeight() }}</p>

  <p>{{ $photo->getStandardResolutionUrl() }}</p>
  <p>{{ $photo->getStandardResolutionWidth() }}</p>
  <p>{{ $photo->getStandardResolutionThumbnailHeight() }}</p>

  <p>{{ $photo->getLowResolutionUrl() }}</p>
  <p>{{ $photo->getLowResolutionWidth() }}</p>
  <p>{{ $photo->getLowResolutionHeight() }}</p>

{{ /list_instagram_photos }}

Instagram照片导入控制台命令

用法

php application/console instagram_photos:ingest lennonwall

其中lennonwall是要从中导入的Instagram标签