amilna / yii2-elevatezoom
基于Yii2的Elevatezoom小部件
    dev-master
    2015-03-13 09:57 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-28 16:36:21 UTC
README
一个基于Elevate Zoom的Yii2提升缩放小部件。
安装
通过composer安装此扩展是首选方式。
运行以下命令之一:
php composer.phar require "amilna/yii2-elevatezoom" "*"
或者将以下内容添加到应用程序的composer.json文件的require部分:
"amilna/yii2-elevatezoom" : "*"
使用方法
在视图中
	use amilna\elevatezoom\ElevateZoom;
 	
	$images = ['an url of zoom image 1','an url of zoom image n'];
	echo ElevateZoom::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 ElevateZoom::widget([
 		'images'=>$images,		
	]);
	*/
'images'是图片数组(1或3维,如果是一维,则应设置baseUrl、smallPrefix和mediumPrefix)或activeDataProvider(如果是activeDataProvider,则应设置imageKey、smallKey和mediumKey)
可用选项
- images
- css (自定义CSS)
- baseUrl (字符串,用于替换基本图片URL)
- smallPrefix (字符串,用于获取小尺寸图片URL)
- mediumPrefix (字符串,用于获取中尺寸图片URL)
- imageKey (存储缩放大小图片的模型属性)
- smallKey (存储小尺寸图片的模型属性)
- mediumKey (存储中尺寸图片的模型属性)
- targetId (自定义容器ID)
- 选项(请参阅示例)