chandrantwins / yii2-ezoom
为 Yii2 的 Elevatezoom 小部件
dev-master
2020-02-05 23:16 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-27 20:45:25 UTC
README
基于 Elevate Zoom 的 Yii2 升级缩放小部件。
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require "chandrantwins/yii2-ezoom" "dev-master"
或者
"chandrantwins/yii2-ezoom" : "dev-master"
将以下内容添加到您的应用程序的 composer.json
文件的 require 部分。
使用方法
在视图中
use chandrantwins\ezoom\EZoom;
$images = ['an url of zoom image 1','an url of zoom image n'];
echo EZoom::widget([
'images'=>$images,
'baseUrl'=>Yii::$app->urlManager->baseUrl.'/upload',
'smallPrefix'=>'/.thumbs',
'mediumPrefix'=>'',
]);
/* //or another example set 'images' with 3 dimension array:
$images'= [
[
'image'=>'an url of zoom image 1',
'small'=>'an url of gallery display image 1',
'medium'=>'an url of basic display image 1'
],
[
'image'=>'an url of zoom image n',
'small'=>'an url of gallery display image n',
'medium'=>'an url of basic display image n'
],
];
echo EZoom::widget([
'images'=>$images,
]);
*/
'images' 是图像数组(1 或 3 维度,如果为 1 维度,则应设置 baseUrl、smallPrefix 和 mediumPrefix)或 activeDataProvider(如果为 activeDataProvider,则应设置 imageKey、smallKey 和 mediumKey)
可用选项
- images
- css(自定义 CSS)
- baseUrl(字符串,用于替换图像 URL)
- smallPrefix(字符串,用于获取小尺寸图像 URL)
- mediumPrefix(字符串,用于获取中等尺寸图像 URL)
- imageKey(存储缩放尺寸图像的模型属性)
- smallKey(存储小尺寸图像的模型属性)
- mediumKey(存储中等尺寸图像的模型属性)
- targetId(自定义容器 ID)
- options(请参阅 示例)