batyukovstudio/bat-media

媒体转换生成器

1.0.0 2024-09-13 11:46 UTC

This package is auto-updated.

Last update: 2024-09-24 14:08:17 UTC


README

Apiato 媒体实体容器

使用时,请连接到相应的实体

接口

HasBatImages

特性

InteractsWithBatImages

您可以在

config/bat-media.conf

此配置文件中更改用于生成图片的基本属性

  • 要选择DATABASE驱动程序,需要填写数据库中的表格,可以使用filament中的页面来完成此操作

  • 要选择CONFIG_FILE驱动程序,需要在模型中添加一个函数

    public function getMediaConfigName(): string { return 'section-modelMedia'; }

配置结构

return [
    'collections' => [
        ModelMediaEnum::COLLECTION_PREVIEW => [
            'is_gallery' => false,
            'format' => MediaFormat::WEBP,
            'non_queued' => true,
            'quality' => 80,
            'conversions' => [
                MediaSize::SMALL->value => [
                    'width' => 672,
                    'height' => 248,
                ],
                MediaSize::MEDIUM->value => [
                    'width' => 672,
                    'height' => 248,
                    'quality' => 90,
                ],
            ],
        ],
        ModelMediaEnum::COLLECTION_GALLERY => [
            'is_gallery' => false,
                'conversions' => [
                    MediaSize::MEDIUM->value => [
                        'width' => 675,
                        'height' => 418,
                        'quality' => 90,
                    ],
                ],
            ],
        ],
    ];