kappa / thumbnails-helper
Simple and intelligent system for creating and work with thumbnails
Installs: 1 027
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >= 5.3.6
- kappa/filesystem: ~4.2.0
- nette/di: ~2.2
- nette/utils: ~2.2
Requires (Dev)
- kappa/tester: 1.1.*
- nette/nette: @dev
This package is auto-updated.
Last update: 2024-09-04 18:32:03 UTC
README
Simple and intelligent system for creating and work with thumbnails
Requirements:
- PHP 5.3.6 or higher
- Nette ~2.1 or higher
- Kappa\FileSystem 4.1.1 or higher
Installation
The best way to install Kappa\ThumbnailsHelper is using Composer:
$ composer require kappa/thumbnails-helper:@dev
Usages
You must register extension:
extensions: thumb: Kappa\ThumbnailsHelper\DI\ThumbnailsHelperExtension
Into presenter or control where you can use this helper add filter (helper)
$template->addFilter('thumb', array($this->thumbnailsHelper, 'process')) // for Nette 2.2 $template->registerHelper('thumb', array($this->thumbnailsHelper, 'process')) // for Nette 2.1
Method in callback must be process()
!
and you can use helper in templates
<img src="{$photo|thumb:'100x300':'fit'}">
Size can be in next formats:
100x
- Width will be 100px and height will be automatically calculatedx100
- Width will be automatically calculated and height will be 100px100x100
- Size will be 100pxx100px
Third argument is resize type, for more info see documentation in czech only
Helper can be configure in config:
thumbDir:
- set path to thumb dir with %wwwDir% (example%wwwDir%/thumbs
)sizeUp
- you can set to true or false when you want small image resize to big imagecontrolFrequency
- you can set count of days for invalidate storage (remove all thumbnails and create a new only from usages images). If you set this option onfalse
or remove option automatically control has been disabled