2017 © Pedro Peláez
 

yii2-extension yii2-thumbnailer

Yii2 component to generate image thumnails of any size

image

daxslab/yii2-thumbnailer

Yii2 component to generate image thumnails of any size

  • Sunday, March 11, 2018
  • by glpzzz
  • Repository
  • 2 Watchers
  • 1 Stars
  • 206 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 7 % Grown

The README.md

Yii2 Thumbnailer

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Yii2 component to generate image thumnails of any size., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist daxslab/yii2-thumbnailer "*"

or add, (*5)

"daxslab/yii2-thumbnailer": "*"

to the require section of your composer.json file., (*6)

Configuration

The basic configuration only requires adding the component to the application:, (*7)

'components' => [
    //...
    'thumbnailer' => [
        'class' => 'daxslab\thumbnailer\Thumbnailer',
    ],
    //...
]

Besides that a default value is always provided, all the options can be configured., (*8)

'components' => [
    //...
    'thumbnailer' => [
        'class' => 'daxslab\thumbnailer\Thumbnailer',
        'defaultWidth' => 500,
        'defaultHeight' => 500,
        'thumbnailsBasePath' => '@webroot/assets/thumbs',
        'thumbnailsBaseUrl' => '@web/assets/thumbs',
        'enableCaching' => true, //defaults to false but is recommended
    ],
    //...
]

Usage

Once the extension is configured, simply use it in your views by:, (*9)

//Generates thumbnail with default values specified in the configuration
Html::img(Yii::$app->thumbnailer->get($imageUrl));

//Generates a 400px width thumbnail. The height is determined as the width because is not set. 
Html::img(Yii::$app->thumbnailer->get($imageUrl, 400));

//Generates a 400x400 pixels thumbnail and 60% quality 
Html::img(Yii::$app->thumbnailer->get($imageUrl, 400, 400));

//Generates a 400x400 pixels thumbnail and 10% quality
Html::img(Yii::$app->thumbnailer->get($imageUrl, 400, 400, 10));

//Generates a 400x400 pixels thumbnail, 10% quality and not cropping the image
//but inserting it into a box with the specified dimensions.
Html::img(Yii::$app->thumbnailer->get($imageUrl, 400, 400, 10, ManipulatorInterface::THUMBNAIL_INSET));

Proudly made by Daxslab., (*10)

The Versions

11/03 2018

dev-master

9999999-dev

Yii2 component to generate image thumnails of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail

11/03 2018

1.0.4

1.0.4.0

Yii2 component to generate image thumnails of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail

11/03 2018

1.0.5

1.0.5.0

Yii2 component to generate image thumnails of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail

02/03 2018

1.0.3

1.0.3.0

Yii2 component to generate image thumnails of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail

27/02 2018

1.0.2

1.0.2.0

Yii2 component to generate image thumnails of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail

21/02 2018

1.0.1

1.0.1.0

Extension to generate thumbnails for images of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail

15/01 2018

1.0.0

1.0.0.0

Extension to generate thumbnails for images of any size

  Sources   Download

MIT

The Requires

 

by Gabriel A. López López

yii2 image thumbnail