chandrantwins/yii2-ezoom

为 Yii2 的 Elevatezoom 小部件

安装: 1

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

语言:JavaScript

类型:yii2-extension

dev-master 2020-02-05 23:16 UTC

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)

可用选项

  1. images
  2. css(自定义 CSS)
  3. baseUrl(字符串,用于替换图像 URL)
  4. smallPrefix(字符串,用于获取小尺寸图像 URL)
  5. mediumPrefix(字符串,用于获取中等尺寸图像 URL)
  6. imageKey(存储缩放尺寸图像的模型属性)
  7. smallKey(存储小尺寸图像的模型属性)
  8. mediumKey(存储中等尺寸图像的模型属性)
  9. targetId(自定义容器 ID)
  10. options(请参阅 示例