2017 © Pedro PelĂĄez
 

symfony-bundle photo-bundle

PhotoBundle client for RefPhoto Symfony2/Symfony3

image

l3/photo-bundle

PhotoBundle client for RefPhoto Symfony2/Symfony3

  • Friday, January 26, 2018
  • by l3-team
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 100 % Grown

The README.md

Symfony 2/ Symfony3 / Symfony4 PhotoBundle Symfony client for RefPhoto

This bundle is a client for the referencial Photo (https://github.com/l3-team/RefPhoto) or (https://github.com/l3-team/RefPhotoJ2EE), (*1)

Pre-requisites

  • have a RefPhoto instance installed (https://github.com/l3-team/RefPhoto) or (https://github.com/l3-team/RefPhotoJ2EE)
  • have a Symfony 2 or Symfony3 or Symfony4 application

Installation

Install the Bundle with this command :, (*2)

composer require l3/photo-bundle:~1.0

For Symfony 2 and Symfony3, add the Bundle in AppKernel.php, (*3)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new L3\Bundle\PhotoBundle\L3PhotoBundle(),
        );

        // ...
    }

    // ...
}

For Symfony4, add the bundle in config/bundles.php file (add the line if not present) :, (*4)

<?php
// config/bundles.php

return [
    ...
    L3\Bundle\PhotoBundle\L3PhotoBundle::class => ['all' => true],
    ...
];

Configuration

For Symfony2 and Symfony3, add and adapt the 3 variables for configuration in the app/config/parameters.yml.dist and app/config/parameters.yml :, (*5)

# app/config/parameters.yml.dist
# app/config/parameters.yml

parameters:
    photo_enabled: true
    photo_image_url: 'https://refphotos.univ.fr/image/'
    photo_token_url: 'https://refphotos.univ.fr/token/add'

Next add the variable %photo_enabled% in app/config/config.yml under twig globals :, (*6)

# app/config/config.yml

# Twig Configuration
twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"
    globals:
        photo_enabled: '%photo_enabled%'

For Symfony4, add and adapt the 3 variables for configuration in the .env.local and .env :, (*7)

# .env.local
# .env

###> l3/photo-bundle ###
PHOTO_ENABLED=true
PHOTO_IMAGE_URL=https://refphotos.univ.fr/image/
PHOTO_TOKEN_URL=https://refphotos.univ.fr/token/add/
###< l3/photo-bundle ###

and add the 3 variables under parameters in the config/services.yaml file :, (*8)

# config/services.yaml

parameters:
    photo_enabled: '%env(bool:PHOTO_ENABLED)%'
    photo_image_url: '%env(string:PHOTO_IMAGE_URL)%'
    photo_token_url: '%env(string:PHOTO_TOKEN_URL)%'

and the variable %photo_enabled% in config/packages/twig.yaml under twig globals :, (*9)

# config/packages/twig.yaml

# Twig Configuration
twig:
    paths: ['%kernel.project_dir%/templates']
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    globals:
        photo_enabled: '%photo_enabled%'

How to use

In your twig views you can use it like this :, (*10)

{% if photo_enabled %}
<img src="{{ photo(p.uid) }}" alt="photo inexistante" />
{% endif %}

The Versions

26/01 2018

dev-master

9999999-dev https://github.com/l3-team/PhotoBundle

PhotoBundle client for RefPhoto Symfony2/Symfony3

  Sources   Download

(c) Copyright Universite Lille3 - Charles de Gaulle LGPL-3.0-or-later

The Requires

 

by Pierre PĂ©lisset
by Mathieu HĂ©tru

26/01 2018

1.1

1.1.0.0 https://github.com/l3-team/PhotoBundle

PhotoBundle client for RefPhoto Symfony2/Symfony3

  Sources   Download

(c) Copyright Universite Lille3 - Charles de Gaulle LGPL-3.0-or-later

The Requires

 

by Pierre PĂ©lisset
by Mathieu HĂ©tru

21/02 2017

1.0

1.0.0.0 https://github.com/l3-team/PhotoBundle

PhotoBundle client for RefPhoto Symfony2

  Sources   Download

(c) Copyright Universite Lille3 - Charles de Gaulle

The Requires

 

by Pierre PĂ©lisset
by Mathieu HĂ©tru