slavkovrn/yii2-prettyphoto

Yii2 prettyPhoto 图片画廊小部件使用 Lightbox 视图控件 jquery.prettyphoto.js

v2.0.0 2019-02-11 07:59 UTC

This package is auto-updated.

Last update: 2024-09-12 04:15:51 UTC


README

此扩展使用 jQuery PrettyPhoto,并从定义的结构 php 数组中生成图像画廊。

PrettyPhoto 图像画廊 PHP 数组生成器.

PrettyPhoto image galary

安装

安装此扩展的首选方式是通过 composer

运行以下命令:

composer require slavkovrn/yii2-prettyphoto

或者

"slavkovrn/yii2-prettyphoto": "*"

将以下内容添加到你的 composer.json 文件的 require 部分中。

用法

在视图中设置到扩展的链接

<?php

use slavkovrn\prettyphoto\PrettyPhotoWidget;

?>

<?= PrettyPhotoWidget::widget([
    'id'     =>'prettyPhoto',   // id of plugin should be unique at page
    'class'  =>'galary',        // class of plugin to define a style
    'width' => '50%',           // width of image visible in widget (omit - initial width)
    'height' => '100px',        // height of image visible in widget (omit - initial height)
    'images' => [               // images at popup window of prettyPhoto galary
                    1 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image1.jpg',
                            'title' => 'Image visible in widget',
                        ],
                    2 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image2.jpg',
                            'title' => 'image 1',
                        ],
                    3 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image3.jpg',
                            'title' => 'image 2',
                        ],
                    4 => [
                            'src' => 'http://yii2.kadastrcard.ru/uploads/prettyphoto/image4.jpg',
                            'title' => 'image 3',
                        ],
                ]
]) ?>

在管理员处添加注释