2017 © Pedro Peláez
 

icanboogie-module module-thumbnailer

Creates thumbnails on demand.

image

icybee/module-thumbnailer

Creates thumbnails on demand.

  • Tuesday, March 13, 2018
  • by olvlvl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 761 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Thumbnailer Build Status

The Thumbnailer module (thumbnailer) Creates thumbnails from images and managed images using options or configured versions., (*1)

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., (*2)

<?php

namespace ICanBoogie\Modules\Thumbnailer;

$versions = $core->thumbnailer_versions;
$versions['popover'] = 'w:420;h:340';
# or
$versions['popover'] = array
(
    'width' => 420,
    'height' => 340
);

$thumbnail = new Thumbnail('/images/madonna.jpeg', 'popover');

echo $thumbnail;      // <img src="/api/thumbnail/420x340/fill?s=%2Fimages%2Fmadonna.jpeg&amp;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', 'w:64;h:64;f:png');

echo $thumbnail;      // <img src="/api/thumbnail/64x64/fill?f=png&amp;s=%2Fimages%2Fmadonna.jpeg" alt="" width="64" height="64" class="thumbnail" />
echo $thumbnail->url; // /api/thumbnail/64x64/fill?f=png&s=%2Fimages%2Fmadonna.jpeg

# Support for the Images module 

$thumbnail = new Thumbnail($core->models['images'][123], 'popover');

echo $thumbnail;      // <img src="/api/images/123/thumbnails/popover" alt="" width="420" height="340" class="thumbnail thumbnail--popover" />
echo $thumbnail->url; // /api/images/123/thumbnails/popover

$core->models['images'][123]->thumbnail('popover');
$core->models['images'][123]->thumbnail('popover')->url;

Event hooks

ICanBoogie\Modules\System\Cache\Collection::alter

Adds our cache manager to the cache collection., (*3)

Icybee\ConfigBlock::alter_children

Adds a thumbnails section to the config block of modules defining thumbnail versions using the "thumbnails" config., (*4)

Icybee\ConfigOperation::properties:before

Pre-parses defined thumbnail versions before the config is saved., (*5)

Prototype methods

Icybee\Modules\Images\Image::thumbnail

Adds the thumbnail() method to the Image active record., (*6)

<?php

$image = $core->models['images']->one;

echo $image->thumbnail('my-version-name');
echo $image->thumbnail('w:64;h:64;m:fit');

Icybee\Modules\Images\Image::get_thumbnail

Adds the thumbnail lazy getter for the view thumbnail version., (*7)

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., (*8)

Requirements

The package requires PHP 5.3 or later., (*9)

Installation

The recommended way to install this package is through Composer. Create a composer.json file and run php composer.phar install command to install it:, (*10)

{
    "minimum-stability": "dev",
    "require": {
        "icybee/module-thumbnailer": "*"
    }
}

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:, (*11)

$ git clone git://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., (*12)

The package is continuously tested by Travis CI., (*13)

Build Status, (*14)

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., (*15)

License

This module is licensed under the New BSD License - See the LICENSE file for details., (*16)

The Versions

25/07 2013

dev-master

9999999-dev http://icybee.org/

Creates thumbnails on demand.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

thumbnail