imponeer / smarty-image
Smarty plugin that adds some image related template syntax enchaments
Installs: 19 616
Dependents: 1
Suggesters: 1
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^7.3|^8.0
- ext-json: *
- imponeer/smarty-extensions-contracts: ^3.0
- intervention/image: ^2.5
- psr/cache: ^1.0|^2.0|^3.0
Requires (Dev)
- bentools/cartesian-product: ^1.3
- phpunit/phpunit: ^8.0 || ^9.0
- symfony/cache: ^5.0|^6.0
- symfony/dom-crawler: ^5.0|^6.0
- symfony/polyfill-php80: ^1.27
README
Smarty Image
Some Smarty syntax plugins for operations with images.
Installation
To install and use this package, we recommend to use Composer:
composer require imponeer/smarty-image
Otherwise, you need to include manually files from src/
directory.
Registering in Smarty
If you want to use these extensions from this package in your project you need register them with registerPlugin
function from Smarty. For example:
$smarty = new \Smarty(); $resizeImagePlugin = new \Imponeer\Smarty\Extensions\Image\ResizeImageFunction($psrCacheAdapter); $smarty->registerPlugin('function', $resizeImagePlugin->getName(), [$resizeImagePlugin, 'execute']);
Using from templates
To resize images from smarty You can use resized_image function:
{resized_image file="/images/image.jpg" height=70}
This function supports such arguments:
All extra arguments will be rendered into image tag, if return mode is image
.
How to contribute?
If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try interactive GitHub tutorial.
If you found any bug or have some questions, use issues tab and write there your questions.