amilna/yii2-elevatezoom

基于Yii2的Elevatezoom小部件

安装数: 11,279

依赖关系: 2

推荐者: 0

安全性: 0

星星: 5

关注者: 2

分支: 9

开放问题: 1

语言:JavaScript

类型:yii2-extension

dev-master 2015-03-13 09:57 UTC

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)

可用选项

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