Developed with love by KnpLabs Hire us for your project!
21

FlickrApiBundle

by ideatosrl

Simple bundle to connect to flickr api

Ideato\FlickrApiBundle

Install

  • Install with composer:

    #composer.json
    "require": {
        ...
        "ideato/flickr-api-bundle": "1.0.*@dev",
        ...
    }
    

If you want to keep using the old version of this bundle and not depend on the flickr-api library, you should use the following branch

    "ideato/flickr-api-bundle": "0.1.*@dev"
  • Add the bundle to your AppKernel:

    #app/AppKernel.php
    $bundles = array(
        ...
        new Ideato\FlickrApiBundle\FlickrApiBundle(),
    );
    

How to use it

  • Add the api_key and the user_id as parameters in your services configuration:

    <parameters>
        <parameter key="flickr_api.user_id">abc</parameter>
        <parameter key="flickr_api.api_key">abcdefg</parameter>
    </parameters>
    
  • To retrieve the photo sets in your controller:

    $photo_sets = $this->get('flickr_api.photogallery_repository')->getPhotoGalleriesPreview();

and to display them:

<ul>
    {% for photo_set in photo_sets %}
    <li>
        <a href="{{ path('photogallery', { 'photoset_id' : photo_set.id }) }}">
            <img alt="{{ photo_set.title }}" src="{{ photo_set.preview }}">
        </a>
        <h4>{{ photo_set.title }}</h4>
        <p>{{ photo_set.description }}</p>
    </li>
    {% endfor %}
</ul>
  • To retrieve only a specific photo set in your controller:

    $photo_set = $this->get('flickr_api.photogallery_repository')->getPhotoGallery($photoset_id);
    if (!$photo_set)
    {
    return new Response('Error message!', 404);
    }

and to display it:

<ul>
    {% for photo in photo_set.photos %}
    <li>
        <a href="{{ photo.url }}">
            <img alt="{{ photo.title }}" src="{{ photo.preview }}">
        </a>
        <h4>{{ photo.title }}</h4>
        <p>{{ photo.description }}</p>
    </li>
    {% endfor %}
</ul>
  • You can access the flickr api directly through the service "flickr_api.api":

    $container->get('flickr_api.api');

Update 2011-07-05

  • Get the most recent photos for the given account:

    $photos = $this->get('flickr_api.photogallery_repository')->getLatestPhotos($limit);

$limit default is 9

  • Update README.md
    By p16, 4 years ago
  • Merge pull request #6 from nicolas-bastien/patch-1
    By p16, 4 years ago
  • Merge branch 'add-dependency-on-flickr-api-library'
    By p16, 4 years ago
  • Update installation to fit new branch alias
    By nicolas-bastien, 4 years ago
  • Merge pull request #5 from nicolas-bastien/patch-1
    By francescotrucchia, 4 years ago
  • Merge pull request #4 from fazy/readme-tweaks
    By francescotrucchia, 4 years ago
  • Add composer branch-alias
    By nicolas-bastien, 4 years ago
  • Fixed some very small typos in the README
    By Lars Janssen, 4 years ago
  • Updates readme
    By p16, 4 years ago
  • Add dependency to ideato/flickr-api
    By p16, 4 years ago
  • Update composer.json
    By p16, 4 years ago
  • Update README.md
    By p16, 4 years ago
  • Merge pull request #2 from leopro/master
    By p16, 4 years ago
  • add composer
    By leopro, 4 years ago
  • add composer
    By leopro, 4 years ago
  • Add junit report to phpunit tests
    By p16, 5 years ago
  • Added phpunit executable
    By p16, 5 years ago
  • Add configuration for running phpcs
    By p16, 5 years ago
  • Add build.xml for ant. Add gitignore.
    By p16, 5 years ago
  • Fixes FlickrApiTest::testGetSinglePhotoSet
    By p16, 5 years ago
  • Merge branch 'master' of github.com:ideatosrl/FlickrApiBundle
    By p16, 5 years ago
  • Rename test.
    By p16, 5 years ago
  • Merge pull request #1 from isometriks/patch-1
    By p16, 5 years ago
  • Added string type casting. Symfony has trouble with these nodes if you try to do a controller redirect / forward because it tries to serialize. It cannot serialize a SimpleXMLElement so it throws an error and causes a big memory issue. You have these same
    By isometriks, 5 years ago
  • Added string type casting. Symfony has trouble with these nodes if you try to do a controller redirect / forward because it tries to serialize. It cannot serialize a SimpleXMLElement so it throws an error and causes a big memory issue. You have these same
    By isometriks, 5 years ago
  • added l size
    By cirpo, 6 years ago
  • updated getLatestPhotos and fixtures
    By micheleorselli, 6 years ago
  • Added the possibility to run the test using only phpunit. Renamed Extension class name to FlickrApiExtension
    By p16, 6 years ago
  • Added fixtures and fixed returned value for getLatestPhotos
    By p16, 6 years ago
  • Refactoring of FlickrApi::getPhotoSetPreview
    By p16, 6 years ago