seiger / sgallery
Evocms 为 Evolution CMS 中的资源库提供的包装,使用表达式的 API 操作图像
v1.3.0
2024-09-16 19:24 UTC
Requires
- php: ^8.2
- spatie/image: 3.*
README
sGallery 是一个多才多艺且不可或缺的插件,专为 Evolution CMS 设计,彻底改变了您在网站内管理媒体资产的方式。特别为 Evolution CMS 管理面板设计,这个动态插件引入了许多强大的功能,以提升您的内容展示。
sGallery 证明了 Evolution CMS 对强大且用户友好的内容管理的承诺。无论您是内容创作者还是管理员,此插件都能让您轻松创建视觉震撼且引人入胜的网站。今天就开始使用 sGallery 提升您的媒体管理体验。
特性
- 图片和视频附件。
- 轻松上传媒体。
- YouTube 集成。
- 可排序的位置。
- 用于文件管理的文本字段。
- 图片调整大小和 AVIF 或 WEBP 转换。
- 与自定义模块的集成。
- sLang 集成。
- 多个标签页。
支持的格式
以下图像格式经过测试并由该包支持。如果您的 GD/Imagick 安装支持不在列表中的格式,您可能可以正常使用它,但效果可能会有所不同。
最低要求
- Evolution CMS 3.2.0
- PHP 8.2.0
- Composer 2.2.0
- PostgreSQL 10.23.0
- MySQL 8.0.3
- MariaDB 10.5.2
- SQLite 3.25.0
使用 artisan 包安装程序进行安装
进入您 /core/ 文件夹
cd core
运行 php artisan 命令
php artisan package:installrequire seiger/sgallery "*"
使用命令生成配置文件 ../core/custom/config/seiger/settings,文件名为 sgallery.php,文件应返回逗号分隔的模板列表。
php artisan vendor:publish --provider="Seiger\sGallery\sGalleryServiceProvider"
使用命令运行 make DB 结构
php artisan migrate
配置
用于显示相册标签的模板配置在
core/custom/config/seiger/settings/sGallery.php
文件中,其中数组包含连接相册的模板 ID。
在 blade 中的使用
使用图像过滤器播种所有文件
@foreach(sGallery::collections()->get() as $item) @if(sGallery::hasImage($item->type)) <a class="swiper-slide" @if(trim($item->link))href="{{$item->link}}"@endif> <div class="container"> <img loading="lazy" class="intro__img" src="{{$item->src}}" alt="{{$item->alt}}" width="1440" height="456"> <div class="intro__inner"> <div class="h1__title">{{$item->title}}</div> <p class="intro__text">{{$item->description}}</p> @if(trim($item->link_text))<div class="btn background__mod">{{$item->link_text}}</div>@endif </div> </div> </a> @endif @endforeach
或 YouTube 过滤器
@foreach(sGallery::collections()->get() as $item) @if(sGallery::hasYoutube($item->type)) <div class="item"> <div class="video"> <iframe width="560" height="315" src="https://www.youtube.com/embed/{{$item->file}}" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> </div> <p>{{$item->title}}</p> </div> @endif @endforeach
或
@foreach(sGallery::collections()->documentId($product->id)->itemType('product')->get() as $item) <div class="swiper-slide"> <a class="js-trigger-fancybox" href="{{$item->src}}" data-fancybox="product-gallery"> <img loading="lazy" src="{{$item->src}}" width="440" height="440" /> </a> </div> @endforeach
集成到产品模块中
只需将此代码粘贴到您的视图后端
{!!sGallery::initialiseView()->viewType('section')->itemType('product')->idType('i')!!}