定制 daddl3/liip_imagine_template_bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

daddl3/liip_imagine_template_bundle

最新稳定版本:v0.1.6

Composer 安装命令:

composer require daddl3/liip_imagine_template_bundle

包简介

Symfony Bundle with image templates for liip Imagine

README 文档

README

Pipeline Status Version

Liip Imagine Template Symfony Bundle

Liip Integration for Symfony

Getting started

This bundle helps you to use Liip Imagine Bundle

Installation

$ composer requ daddl3/liip_imagine_template_bundle

Config

you have to config liip_imagine like this

liip_imagine:

  resolvers:
    data:
      web_path:
        web_root: "%kernel.project_dir%/public"
        cache_prefix: media/cache/resolve

  loaders:
    data:
      filesystem:
        data_root: "%kernel.project_dir%/data" // important

Avif and Webp

to enable one of them just add those

    parameters:
        daddl3_liip_imagine_template.avif: true
        daddl3_liip_imagine_template.webp: true

Manual Image Generation

To manually generate images (to avoid slow automatic generation), use the provided command.

How it works:

  1. Applies Liip Imagine filters (resize, crop, etc.) to create filtered JPG/PNG images
  2. Creates WebP/AVIF versions of filtered images using GD (if enabled in config)

Important: The command respects your configuration parameters:

  • If daddl3_liip_imagine_template.webp: true is set, WebP images will be generated automatically using GD
  • If daddl3_liip_imagine_template.avif: true is set, AVIF images will be generated automatically using GD
  • You can override these settings using command flags
# Generate images using config parameters (webp/avif based on your config)
php bin/console daddl3:liip:generate-images news_pics/folder --all-filters

# Generate standard JPG/PNG images for a single file with specific filters
php bin/console daddl3:liip:generate-images news_pics/folder/image.jpg -f meta -f meta_tablet -f meta_mobile

# Force WebP generation (overrides config)
php bin/console daddl3:liip:generate-images news_pics/folder --all-filters --webp

# Force AVIF generation (overrides config)
php bin/console daddl3:liip:generate-images news_pics/folder --all-filters --avif

# Generate ALL formats (JPG/PNG + WebP + AVIF) - overrides config
php bin/console daddl3:liip:generate-images news_pics/folder --all-filters --all-formats

# Generate with custom filters and force WebP
php bin/console daddl3:liip:generate-images news_pics/folder -f slider_image -f slider_image_tablet --webp

# Show available options
php bin/console daddl3:liip:generate-images --help

Command Options:

  • path (required): Path to image or directory relative to data root
  • --filters or -f: Specify filter names (can be used multiple times)
  • --webp or -w: Force WebP generation (overrides config parameter)
  • --avif: Force AVIF generation (overrides config parameter)
  • --all-formats: Generate all formats (JPG/PNG, WebP, AVIF) - overrides config
  • --all-filters or -a: Apply common filters (meta, meta_tablet, meta_mobile)

Note: If you don't specify --webp, --avif, or --all-formats, the command will use your configuration parameters (daddl3_liip_imagine_template.webp and daddl3_liip_imagine_template.avif).

Examples:

# Pre-generate all images for a news article with all formats (override config)
php bin/console daddl3:liip:generate-images news_pics/article-123 --all-filters --all-formats

# Pre-generate slider images using config settings
php bin/console daddl3:liip:generate-images news_pics/slider -f slider_image -f slider_image_tablet -f slider_image_mobile

# Pre-generate with only WebP, even if config has avif enabled
php bin/console daddl3:liip:generate-images news_pics/slider --all-filters --webp
Information

Some functions are just for my infrastructure

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-08