flame/thumbnail-helper

Nette template helper for lazy creating of thumbnails

v3.0 2013-08-26 08:51 UTC

README

Nette template helper for lazy creating of thumbnails

Instalation

Examples is based on Nette version 2.0.12, but the package is compatible with @dev version too

Register "thumb" extension

In bootstrap.php

\Flame\Thumb\DI\ThumbExtension::register($configurator);

Register "thumb" helper

    /**
     * Base presenter for all application presenters.
     */
    abstract class BasePresenter extends Presenter
    {

        /**
         * @param null $class
         * @return \Nette\Templating\ITemplate
         */
        protected function createTemplate($class = null)
        {
            $template = parent::createTemplate($class);
            /** @var \Flame\Thumb\IRegister $thumb */
            $thumb = $this->context->getByType('Flame\Thumb\IRegister');
            $thumb->register($template);
            return $template;
        }
    }

Set variables (Optional)

In config.neon

    thumb:
        paths:
            base: %wwwDir%
            thumbs: /media/thumbs

That's all! Enjoy it!