承接 hounddd/wn-lightgallery-plugin 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

hounddd/wn-lightgallery-plugin

Composer 安装命令:

composer require hounddd/wn-lightgallery-plugin

包简介

Galleries plugin for Winter CMS with lightbox support

README 文档

README

Create stunning images and videos galleries for your WinterCMS website in minutes. Responsive, touch-friendly, and easy to use.

This plugin use lightGallery script v2.4.0.

Features

  • Create galleries of images organized in categories
  • A gallery can be shown either as thumbnails or as an inline lightbox
  • Compatible page snippet for Winter Pages plugin
  • Fully translate

lightGallery script features

  • Vanilla javascript, no dependencies required, not even jquery
  • Fully responsive.
  • Modular architecture with built in plugins.
  • Highly optimized for touch devices.
  • Mouse drag supports for desktops.
  • Double-click/Double-tap to see actual size of the image.
  • Animated thumbnails.
  • Social sharing.
  • YouTube Vimeo Wistia and html5 videos Support.
  • 20+ Hardware-Accelerated CSS3 transitions.
  • Dynamic mode.
  • Inline gallery
  • Full screen support.
  • Zoom in/out, Pinch to zoom.
  • Swipe/Drag up/down support to close gallery
  • Browser history API(deep linking).
  • Responsive images.
  • HTML iframe support.
  • Multiple instances on one page.
  • Easily customizable via CSS (SCSS) and Settings.
  • Smart image preloading and code optimization.
  • Keyboard Navigation for desktop.
  • SVG icons.
  • Accessibility support.
  • Rotate, flip images.
  • And many more.

Installation

Let assume you're in the root of your wintercms installation

Using composer

Just run this command

composer require hounddd/wn-lightgallery-plugin

Clone

Clone this repo into your winter plugins folder.

cd plugins
mkdir hounddd && cd hounddd
git clone https://github.com/Hounddd/wn-lightgallery-plugin lightgallery

Note: Run php artisan winter:up command Add {% styles %} and {% scripts %} placeholders in your layout or page <header> tag, if it is not already the case.

Components

This plugin offer 2 components and 1 static page snippet.

  • galleriesList component, display list of galleries
  • gallerySlug component, display in a page a gallery based on his URL
  • galleryId page snippet, display in a page a gallery based on his ID

Galleries list

Use the galleryList component to display a list of latest galleries on a page. The component has the following properties:

  • galleryPage - path to the gallery details page. The default value is galleries/gallery - it matches the pages/galleries/gallery.htm file in the theme directory. This property is used in the default component partial for creating links to the gallery images.
  • categoryPage - path to the category page. The default value is galleries/category - it matches the pages/galleries/category.htm file in the theme directory. This property is used in the default component partial for creating links to the gallery images.
  • galleriesPerPage - how many galleries to display on a single page (the pagination is supported automatically). The default value is 9.
  • pageNumber - this value is used to determine what page the user is on, it should be a routing parameter for the default markup. The default value is {{ :page }} to obtain the value from the route parameter :page.
  • noGalleriesMessage - message to display in on empty galleries list.

The galleryList component injects the following variables to the page where it's used:

  • galleries - a list of galleries loaded from the database.
  • category - the galleries category object loaded from the database. If the category is not found, the variable value is null.
  • galleryPage - contains the value of the galleryPage component's property.
  • categoryPage - contains the value of the categoryPage component's property.
  • pageParam - contains the value of the current viewing page.
  • noPostsMessage - contains the value of the noPostsMessage component's property.

The component supports pagination and reads the current page index from the :page URL parameter. The next example shows the basic component usage:

title = "Show galleries"
url = "/galleries/:page?"
layout = "default"
is_hidden = 1

[viewBag]
localeUrl[fr] = "/galeries/:page?"
localeTitle[fr] = "Affiche une liste de galleries"

[galleriesList]
galleryPage = "galleries/gallery"
categoryPage = "galleries/category"
galleriesPerPage = 6
pageNumber = "{{ :page }}"
noGalleriesMessage = "No gallery found"
==
{% component 'galleriesList' %}

The next example shows the basic component usage with the category filter:

title = "Galleries Category"
url = "/galleries/category/:slug/:page?"

[galleriesList]
categoryFilter = "{{ :slug }}"
==
function onEnd()
{
    // Optional - set the page title to the category name
    if ($this->category)
        $this->page->title = $this->category->name;
}
==
{% if not category %}
    <h2>Category not found</h2>
{% else %}
    <h2>{{ category.name }}</h2>

    {% component 'galleriesList' %}
{% endif %}

The galleries and the pagination are coded in the default component partial plugins/hounddd/lightgallery/components/galleries/default.htm. If the default markup is not suitable for your website, feel free to copy it from the default partial and replace the {% component %} call in the example above with the partial contents.

Gallery (by slug)

Use the gallerySlug component to display a gallery on a page. The component has the following properties:

  • inline - the display mode of the gallery.
  • noImagesMessage - message to display in an empty gallery.
  • plugins - the plugins used by lightGallery script.
  • preload - the number of preload slides.
  • mode - the ype of transition between images.
  • speed - the transition duration (in ms).
  • loop - the ability to loop back to the beginning of the gallery from the last slide.
  • pause - the the time (in ms) between each auto transition.
  • counter - whether to show total number of images and index number of currently displayed image.
  • controls - whether or not to display the prev/next buttons.
  • download - whether or not to display the download button.
  • escKey - whether the LightGallery could be closed by pressing the "Esc" key.
  • prevHtml - custom html for prev control.
  • nextHtml - custom html for next control.
  • width - the width of the thumbnails to be displayed in the gallery.
  • height - the height of the thumbnails to be displayed in the gallery.
  • resizer - how the image should be fitted to dimensions.
  • categoryPage - path to the category page. The default value is galleries/category - it matches the pages/galleries/category.htm file in the theme directory. This property is used in the default component partial for creating links to the gallery images.

The gallerySlug component injects the following variables to the page where it's used:

  • gallery - the gallery object loaded from the database. If the post is not found, the variable value is null.
  • noImagesMessage - contains the value of the noImagesMessage component's property.

The next example shows the basic component usage on the gallery page:

title = "Display a gallery"
url = "/gallery/:slug"
layout = "default"
is_hidden = 1

[viewBag]
localeUrl[en] = "/galerie/:slug"
localeTitle[fr] = "Affiche une galerie"

[gallerySlug]
slug = "{{ :slug }}"
inline = "false"
noImagesMessage = "No images in this gallery"
plugins[] = "lgThumbnail"
plugins[] = "lgZoom"
preload = 2
mode = "lg-slide"
speed = 600
loop = "true"
pause = 5000
counter = "true"
controls = "true"
download = "true"
escKey = "true"
width = 300
height = 300
resizer = "auto"
==
{% component 'gallerySlug' %}

The gallery details are coded in the component partials wich are shared between gallerySlug component and galleryId page snippet.

  • plugins/hounddd/lightgallery/components/partials/gallery.htm for thumbs view launching lightbox on click.
  • plugins/hounddd/lightgallery/components/partials/gallery_inline.htm for inline lightbox view.

Blocks

This plugin provides a block compatible with the Winter.blocks plugin.

Block lightgallery_gallery

This block provide a simple way to add an images gallery to your content.

Property Type Description
gallery Integer Gallery ID to display
maxImages Integer Number of images per gallery between 2, 4 or 6.
Default: '4'

Notes

🔑 Licence key

If you want to use lightGallery to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Read more about the commercial license

🏆 Credits

This plugin is inspired by rjchauhan / RJGallery-for-OctoberCMS of which it can be a replacement*. Besides the removal of jQuery from the dependencies, it brings some new features compared to the source plugin:

  • Update to last stable version of LightGallery script (v2.4.0)
  • Default image for galleries
  • Use external CSS with class selectors
  • Add real anchor link to large file
  • Customisables "prev" and "next" buttons

* It may have some breaking changes as the component Gallery doesn't exist anymore.

Make awesome sites with ❄ WinterCMS!

hounddd/wn-lightgallery-plugin 适用场景与选型建议

hounddd/wn-lightgallery-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 295 次下载、GitHub Stars 达 6, 最近一次更新时间为 2022 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「gallery」 「lightbox」 「galleries」 「winter」 「winter cms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 hounddd/wn-lightgallery-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 hounddd/wn-lightgallery-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 hounddd/wn-lightgallery-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-11