定制 mezcalito/imgproxy-bundle 二次开发

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

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

mezcalito/imgproxy-bundle

最新稳定版本:0.5.1

Composer 安装命令:

composer require mezcalito/imgproxy-bundle

包简介

README 文档

README

This bundle provides imgproxy integration for Symfony based projects.

Installation

Run this command in your terminal:

composer require mezcalito/imgproxy-bundle

If you don't use Symfony Flex, you must enable the bundle manually in the application:

<?php

return [
    // ...
    Mezcalito\ImgproxyBundle\ImgproxyBundle::class => ['all' => true]
];

Basic Usage

This bundle works by applying presets on images, from template or from your code. Your presets are defined within the application's configuration file (/config/packages/imgproxy.yaml).

At the moment, there is only one preset available with this bundle: the resize preset. More possibilities will be added later.

To use this bundle, create the following file:

# config/packages/imgproxy.yaml

imgproxy:
    host: localhost
    media_url: https://media.localhost

    # set the same key and salt in imgproxy environment (https://docs.imgproxy.net/signing_the_url)
    signature:
        key: c27f2c1d
        salt: fa242e79

    # default settings applied for all presets
    default_preset_settings:
        format: webp
        encode: true

    presets:
        # this is a preset example
        png_thumbnail:
            format: png
            options:
                resize:
                    resizing_type: fit
                    width: 150
                    height: 75
                    enlarge: true
                    extend:
                        extend: true
                        gravity:
                            type: no
                            x_offset: 10
                            y_offset: 10
                rotate:
                    angle: 90

Then, you can use your preset in your templates:

<img src="{{ asset('/relative/path/to/image.jpg') | imgproxy_preset('png_thumbnail') }}" />

Issues and feature requests

Please report issues and request features at https://github.com/mezcalito/imgproxy-bundle/issues.

License

This bundle is under the MIT license. For the whole copyright, see the LICENSE file distributed with this source code.

统计信息

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

GitHub 信息

  • Stars: 11
  • Watchers: 5
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-27