icybee / module-thumbnailer
Creates thumbnails on demand.
Installs: 773
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:icanboogie-module
Requires
- php: >=5.5.0
- ext-gd: *
- brickrouge/brickrouge: ^2.1.4
- icanboogie/event: ^1.4.0
- icanboogie/image: ^0.0.2
- icanboogie/module-installer: ^1.2.3
- icybee/module-registry: ^2.0.0
- olvlvl/filecache: dev-master
Requires (Dev)
- icanboogie/bind-activerecord: ^0.3.0
- icanboogie/icanboogie: ^2.4.0
- icybee/core: ^2.1.0
- icybee/module-cache: ^2.1.0
Suggests
- icybee/module-cache: Allows thumbnails cache management from Icybee's admin.
This package is auto-updated.
Last update: 2024-11-20 06:48:27 UTC
README
The Thumbnailer module (thumbnailer
) creates thumbnails from images and managed
images using options or configured versions.
The module extends the Image active record with the thumbnail()
method and the thumbnail
lazy getter, and provides an interface to configure and manage its cache that integrates with the
unified cache system of the "Cache" module (cache). The module also extends the core object
with the thumbnail_versions
lazy getter.
<?php namespace ICanBoogie\Modules\Thumbnailer; $versions = $app->thumbnailer_versions; $versions['popover'] = [ 'width' => 420, 'height' => 340 ]; # or $versions['popover'] = 'w:420;h:340'; # or $versions['popover'] = '{"w":"420","h":"340"}'; # or $versions['popover'] = '420x340'; $thumbnail = new Thumbnail('/images/madonna.jpeg', 'popover'); echo $thumbnail; // <img src="/api/thumbnail/420x340/fill?s=%2Fimages%2Fmadonna.jpeg&v=popover" alt="" width="420" height="340" class="thumbnail thumbnail--popover" /> echo $thumbnail->url; // /api/thumbnail/420x340/fill?s=%2Fimages%2Fmadonna.jpeg&v=popover $thumbnail = new Thumbnail('/images/madonna.jpeg', '64x64.png'); echo $thumbnail; // <img src="/api/thumbnail/64x64/fill.png&s=%2Fimages%2Fmadonna.jpeg" alt="" width="64" height="64" class="thumbnail" /> echo $thumbnail->url; // /api/thumbnail/64x64/fill.png&s=%2Fimages%2Fmadonna.jpeg
Event hooks
ICanBoogie\Modules\System\Cache\CacheCollection::alter
Adds our cache manager to the cache collection.
Icybee\ConfigBlock::alter_children
Adds a thumbnails section to the config block of modules defining thumbnail versions using the "thumbnails" config.
Icybee\Operation\Module\ConfigOperation::properties:before
Pre-parses defined thumbnail versions before the config is saved.
Prototype methods
ICanBoogie\Core\get_thumbnail_versions
Adds the thumbnail_versions
lazy getter to the core object. The getter returns a version
collection configured with the versions saved in the registry. Third parties may alter this
collection with an event hook attached to the ICanBoogie\Modules\Thumbnailer\Versions::alter
event.
Requirements
The package requires PHP 5.5 or later.
Installation
The recommended way to install this package is through Composer:
$ composer require icybee/module-thumbnailer
Cloning the repository
The package is available on GitHub, its repository can be cloned with the following command line:
$ git clone https://github.com/Icybee/module-thumbnailer.git thumbnailer
Testing
The test suite is ran with the make test
command. Composer is
automatically installed as well as all the dependencies required to run the suite. The package
directory can later be cleaned with the make clean
command.
The package is continuously tested by Travis CI.
Documentation
The package is documented as part of the Icybee CMS
documentation. The documentation for the package and its
dependencies can be generated with the make doc
command. The documentation is generated in
the docs
directory using ApiGen. The package directory can later by
cleaned with the make clean
command.
License
This module is licensed under the New BSD License - See the LICENSE file for details.