Replace <img> tags on the fly with auto generated thumbnails and a link to the image. Useful with the fancybox extension.
Yii 1.1 or above.
$this->beginWidget('application.extensions.thumbnailer.Thumbnailer', array( 'thumbsDir' => 'images/thumbs', 'thumbWidth' => 200, 'thumbHeight' => 150, // Optional ) ); // This portion is captured by the widget <img src="images/example.jpg" /> <img src="images/anotherExample.jpg" /> <img src="images/yetAnotherExample.jpg" /> // Replace the images with thumbnails <?php $this->endWidget();
This outputs:-
<a href="images/example.jpg" rel="gallery"> // The thumbnail images are created when the page is loaded for the first time! // To create the thumbnail, simpleimage is used. <img src="images/thumbs/example.jpg"> </a> <a href="images/anotherExample.jpg" rel="gallery"> <img src="images/thumbs/anotherExample.jpg"> </a> <a href="images/yetAnotherExample.jpg" rel="gallery"> <img src="images/thumbs/yetAnotherExample.jpg"> </a>
The following extension must be installed:-
Total 3 comments
Hi, Check my fixed version, it works better with paths like href="/images" : http://mir.cr/1GTEYMHJ
Unzip all files to /protected/extensions/ Don't forget to add this (into config/main.php) :
crops images even when they are smaller then the set size
Leave a comment
Please login to leave your comment.