PieceMaker2 image slider by ModularWeb now in a widget with easy configuration options.
Requirements ¶
I am using Yii 1.1.7 but also tested it on Yii 1.1.6.
Usage ¶
Example code to embed this widget:
<!-- Sample code to insert piecemaker widget into view files. -->
<div id="piecemaker-container" class="span-22 prepend-1 append-1">
<?php $this->widget('application.extensions.piecemaker.PieceMaker', array(
'contents'=>array(
array(
'image' /*type*/,
'images/gallery/Fly Agaric Fly Hawaii.jpg' /*url*/,
'Fly Agaric Fly Hawaii' /*title*/,
'<p><em>Photo Source:<em> DeviantArt</p>' . PHP_EOL /*info*/,
'http://www.yiiframework.com/extension/piecemakerwidget/' /*link*/,
'_page' /*link-target*/,
),
array(
'image', 'images/gallery/Ford Mustang.jpg', 'Ford Mustang',
/* These three params are required. */
),
array(
'flash',
'images/demo/flash.swf',
'Title',
'images/demo/flash-preview.png' ),
array(
'video',
'images/demo/video.mp4',
'Title',
800 /*width*/,
450 /*height*/,
true /*autoplay video?*/,
'images/demo/video-preview.jpg' ),
),
'transitions'=>array(
array( 9 /*pieces*/,
1.2 /*time*/,
'easeInOutBack' /*transition*/,
0.1 /*delay*/,
300 /*depth-offset*/,
30 /*cube-distance*/ ),
array(15, 3, 'easeInOutElastic', 0.03, 200, 10),
array(5, 1.3, 'easeInOutCubic', 0.1, 500, 50),
array(9, 1.25, 'easeInOutBack', 0.1, 900, 5),
),
)); ?>
</div>
You can also add flash or video content.
Try:
'contents' => array( array('images/demo/flash.swf', 'Title', 'images/demo/flash-preview.png'), array('images/demo/video.mp4', 'Title', 800 /*width*/, 450 /*height*/, true /*autoplay video?*/, 'images/demo/video-preview.jpg'), ),
Note that the video url must be relative to the piecemaker.swf object so a '../../' is prepended to the video url internally. Just something to keep in mind when the video doesn't work.
Impressive!
Looks awesome,I will integrate this with my nivoSliderManagement extension so that images can be easily managed by the end user...
It's so beautiful!
I love it!
Thanks DrumAddict
Haha, already a promise for extension of my work, :). For your benefit, I must tell you something.
The PieceMaker 2 slider by ModularWeb has a vast array of options. I did not try to figure out what each option does. And I didn't add a way to configure those options form within the view files as it would become cumbersome.
So if you want to tweak the widget's settings, just modify the node within defaults.xml in the extensions folder.
Correction
Sorry it should have read "just modify the
<Settings
> node within defaults.xml in the extensions folder." Really should have previewed.I have the demo a bit. The buttons are now centered and I have added an Info node for every image. Uploading the updated files now.
Language?
I noticed that greek characters do not get rendered for title and description.No language support??
Problems when used in Apache Server,more than one instance
I use Piecemaker in two different pages in my website.Locally in my localhost ,the piecemaker.xml file,is rewritten for every page and published in the assets folder.So it works OK.Live on the server though,the piecemaker.xml is overwritten in the extensions folder but cannot be published to the assets folder.So the same set of images is displayed nomatter what page is visited.I tried changing all the permissions to 0777 both in the extensions folder and in the published assets folder,but no luck.I will appreciate your help.
UPDATE
The problem is in Piecemaker.php file :
$this->assetsUrl = Yii::app()->getAssetManager()->publish( Yii::getPathOfAlias('application.extensions.piecemaker.assets'), false, -1, YII_DEBUG );
The fourth parameter in publish is the source of the problem.It worked locally with two galleries because I was in debug mode so YII_DEBUG=true which means force copy assets folder even if it exists,so everytime the xml file changes (for every gallery) it gets published and the new gallery shows up.In production mode however,this parameter is false,so the assets folder is not overwritten so the xml file is always the same,and only one gallery is shown.A solution is to replace YII_DEBUG with true,but ofcourse we have a little performance issue,since the assets folder gets published every time we switch from one gallery to another.
I hope I saved some ppl from serious headache!
Thanks Drumaddict
Sorry, I have been out of touch with this extension for a long time.
I am glad that you have found and fixed the problem. I have never tested this with multiple instances. Anyway rewriting the assets folder on every page is bad for performance reasons. Maybe it should maintain multiple assets folders, one for each instance.
I'll look into it.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.