2017 © Pedro Peláez
 

library nette-thumbnail

Thumbnail extension for Nette Framework

image

geniv/nette-thumbnail

Thumbnail extension for Nette Framework

  • Friday, July 20, 2018
  • by geniv
  • Repository
  • 1 Watchers
  • 1 Stars
  • 171 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 264 % Grown

The README.md

Thumbnail

Installation

$ composer require geniv/nette-thumbnail

or, (*1)

"geniv/nette-thumbnail": "^1.2"

require:, (*2)

"php": ">=7.0",
"nette/caching": ">=3.0",
"nette/di": ">=3.0",
"nette/php-generator": ">=3.0",
"nette/utils": ">=3.0",
"latte/latte": ">=2.8"

Include in application

default resize flag: SHRINK_ONLY, via: https://doc.nette.org/cs/2.4/images, (*3)

Quality

via: https://api.nette.org/2.4/source-Utils.Image.php.html#512-549 - JPEG - 0-100; default: 85 - PNG - 0-9; default: 9 - GIF - nothing - WEBP - 0-100; default: 80, (*4)

lazyLoad: true is only for <img src="..."> because it is terminated php after generate one picture. waitImage must be defined!, (*5)

neon configure:, (*6)

# thumbnail
thumbnail:
    dir: %wwwDir%/../
    thumbPath: %wwwDir%/files/image/thumbnail/
    thumbUrl: https://example.com # or use %baseUrl% from parameters section
    noImage: www/images/no-image.svg
#    waitImage: www/images/wait-image.gif
#    lazyLoad: false
#    defaultFlag: Nette\Utils\Image::SHRINK_ONLY
#    cache: false
    template:
        projectBlock:
            path: www/images/
            width: 250
            height: 150
            flags: [FILL,SHRINK_ONLY]
            quality: 75

neon configure extension:, (*7)

extensions:
    thumbnail: Thumbnail\Bridges\Nette\Extension

usage:, (*8)

{* path, image, [width], [height], [image flag], [quality] *}
or
{* template, image *}

{* path/to/image.png *}
{thumb 'www/images/', '1920x1080.png', 200, 150, ['FIT'], 75}
{thumb 'www/images/', '1920x1080.png', 200, 150, [], 6}
{thumb 'www/images/', '1920x1080.png', 200, 150, ['FILL']}
{thumb 'www/images/', '1920x1080.png', 200, 150}
{thumb 'www/images/', '1920x1080.png', '50%', '75%'}
{thumb 'www/images/', '1920x1080.png', 200}
{thumb projectBlock, '1920x1080.png'}
{thumb projectBlock, $item['image']}

{thumb $presenter->context->parameters['gallery']['pathToImage'], $item['image'], 120, 121}

{* combine usage *}
<img src="{thumb projectBlock, $item['image']}">

{* accept modifier dataStream for base64 *}
{thumb projectBlock, $item['image']|dataStream}

{* example output: *}
{* output is not contains absolute url! eg: *}
{* www/images/1920x1080-131745-2019-01-28-00-37-50_p..SwwwSfilesSfileSwh64f1qmt1548632270.jpg *}

presenters:, (*9)

Thumbnail::setDefaultImageFlag(int $flag)
Thumbnail::setNoImage(string $path)
Thumbnail::setWaitImage(string $path)
Thumbnail::setLazyLoad(bool $state)
Thumbnail::setCache(bool $state)

Thumbnail::cleanThumbnail(): array
Thumbnail::synchronizeThumbnail([__DIR__.'/../../www/images/']) : array
Thumbnail::getUnusedFiles([__DIR__.'/../../www/images/']) : array
Thumbnail::isSrcPathExists(string $path, string $file = null): bool
Thumbnail::getSrcPath(string $path, string $file = null, string $width = null, string $height = null, array $flags = [], int $quality = null): string

The Versions

20/07 2018

dev-master

9999999-dev

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

20/07 2018

v1.1.6

1.1.6.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

20/07 2018

dev-develop

dev-develop

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

01/07 2018

v1.1.5

1.1.5.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

14/06 2018

v1.1.4

1.1.4.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

31/05 2018

v1.1.3

1.1.3.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

31/05 2018

v1.1.2

1.1.2.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

30/05 2018

v1.1.1

1.1.1.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

27/05 2018

v1.1.0

1.1.0.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

26/05 2018

v1.0.9

1.0.9.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

26/05 2018

v1.0.8

1.0.8.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

15/05 2018

v1.0.7

1.0.7.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

10/05 2018

v1.0.6

1.0.6.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

09/05 2018

v1.0.5

1.0.5.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

09/05 2018

v1.0.4

1.0.4.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

08/05 2018

v1.0.3

1.0.3.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

07/05 2018

v1.0.2

1.0.2.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

07/05 2018

v1.0.1

1.0.1.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv

06/05 2018

v1.0.0

1.0.0.0

Thumbnail extension for Nette Framework

  Sources   Download

MIT

The Requires

 

by Radek Frystak

nette thumbnail geniv