ideato / flickr-api-bundle
Symfony Flickr Api
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 711
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 35
Forks: 5
Type:symfony-bundle
Requires
- php: >=5.3.3
- ideato/flickr-api: dev-master
This package is not auto-updated.
Last update: 2020-08-07 17:57:27 UTC
README
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