l3/photo-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

l3/photo-bundle

Composer 安装命令:

composer require l3/photo-bundle

包简介

PhotoBundle client for RefPhoto Symfony2/Symfony3/Symfony4/Symfony5/Symfony6/Symfony7

README 文档

README

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

Pre-requisites

Installation

Install the Bundle with this command :

composer require l3/photo-bundle:~1.0

For Symfony 2 and Symfony3, add the Bundle in AppKernel.php

<?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) :

<?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 :

# 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 :

# 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 :

# .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 :

# 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 :

# 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 :

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

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2017-02-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固