2017 © Pedro Peláez
 

cakephp-plugin cakephp-thumber

Thumber plugin for CakePHP

image

mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  • Monday, July 2, 2018
  • by mirko-pagliai
  • Repository
  • 1 Watchers
  • 4 Stars
  • 7,123 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 22 Versions
  • 7 % Grown

The README.md

cakephp-thumber

Software License CI codecov Codacy Badge CodeFactor, (*1)

cakephp-thumber is a CakePHP plugin to create thumbnails., (*2)

It uses intervention/image and provides: * ThumbCreator, an utility to create thumbnails; * ThumbHelper, a convenient helper that allows you to create thumbnails on the fly from your templates., (*3)

Starting from 1.8.0 release, much of the code has been moved into the php-thumber package, so that it becomes a php library independent from CakePHP. This plugin continues to exist and all classes and methods remain unchanged, but it only includes the code closely related to CakePHP (commands, helpers, middlewares, etc). The namespace prefix is now Thumber\Cake and no longer Thumber., (*4)

Did you like this plugin? Its development requires a lot of time for me. Please consider the possibility of making a donation: even a coffee is enough! Thank you., (*5)

Make a donation, (*6)


Requirements and supported formats

cakephp-thumber requires GD Library (>=2.0) or Imagick PHP extension (>=6.5.7). It's highly preferable to use Imagick, because It provides better performance and a greater number of supported formats., (*7)

Supported formats may vary depending on the library used., (*8)

JPEG PNG GIF TIF BMP ICO PSD
GD Yes Yes Yes No No No No
Imagick Yes Yes Yes Yes Yes Yes Yes

For more information about supported format, please refer to the Intervention Image documentation., (*9)

Installation

You can install the plugin via composer:, (*10)

$ composer require --prefer-dist mirko-pagliai/cakephp-thumber

Then you have to load the plugin. For more information on how to load the plugin, please refer to the Cookbook., (*11)

Simply, you can execute the shell command to enable the plugin:, (*12)

bin/cake plugin load Thumber/Cake

This would update your application's bootstrap method., (*13)

By default the plugin uses the APP/tmp/thumbs directory to save the thumbnails. So you have to create the directory and make it writable:, (*14)

$ mkdir tmp/thumbs && chmod 775 tmp/thumbs

If you want to use a different directory, read the Configuration section., (*15)

Installation on older CakePHP and PHP versions

Recent packages and the master branch require at least CakePHP 5.0 and PHP 8.1 and the current development of the code is based on these and later versions of CakePHP and PHP. However, there are still some branches compatible with previous versions of CakePHP and PHP., (*16)

For PHP 8.0 and CakePHP 4 or later

The cakephp4 branch requires at least PHP >=7.4 and CakePHP ^4.4., (*17)

In this case, you can install the package as well:, (*18)

$ composer require --prefer-dist mirko-pagliai/cakephp-thumber:dev-cakephp4

Note that the cakephp4 branch will no longer be updated as of January 5, 2024, except for security patches, and it matches the 1.11.3 version., (*19)

For PHP 7.2 or later

The php7.2 branch requires at least PHP 7.2., (*20)

In this case, you can install the package as well:, (*21)

$ composer require --prefer-dist mirko-pagliai/cakephp-thumber:dev-php7.2

Note that the php7.2 branch will no longer be updated as of April 29, 2022, except for security patches, and it matches the 1.9.9 version., (*22)

For PHP 5.6 and CakePHP 3 or later

The cakephp3 branch requires at least PHP 5.6 and CakePHP 3., (*23)

In this case, you can install the package as well:, (*24)

$ composer require --prefer-dist mirko-pagliai/cakephp-thumber:dev-cakephp3

Note that the cakephp3 branch will no longer be updated as of May 7, 2021, except for security patches, and it matches the 1.9.4 version., (*25)

Configuration

The plugin uses some configuration parameters and you can set them using the \Cake\Core\Configure class, before loading the plugin., (*26)

For example, you can do this at the bottom of the file APP/config/app.php of your application., (*27)

Configuration values

Configure::write('Thumber.driver', 'imagick');

Setting Thumber.driver, you can choose which driver to use for the creation of thumbnails. Valid values are imagick or gd., (*28)

Configure::write('Thumber.target', TMP . 'thumbs');

Setting Thumber.target, you can use another directory where the plugin will save thumbnails., (*29)

How to use

See our wiki: * How to use the helper * How to use the ThumbCreator utility, (*30)

And refer to our API., (*31)

Testing

The library (GD or Imagick) to be tested is set by the tests/bootstrap.php file, using the THUMBER_DRIVER environment variable. By default, Imagick is used., (*32)

For example:, (*33)

if (!getenv('THUMBER_DRIVER')) {
    putenv('THUMBER_DRIVER=imagick');
}

Configure::write('Thumber.driver', getenv('THUMBER_DRIVER'));

Moreover, some tests belong to the imageEquals group. These tests generate thubnails and compare them with pre-loaded thumbnails (inside tests/comparing_files/). By default, these tests are not performed, because the images may be different if generated from different environments and systems., (*34)

To exclude these tests, you should run:, (*35)

vendor/bin/phpunit --exclude-group imageEquals

Versioning

For transparency and insight into our release cycle and to maintain backward compatibility, Thumber will be maintained under the Semantic Versioning guidelines., (*36)

The Versions

02/07 2018
02/07 2018
19/06 2018
19/04 2018
28/03 2018
28/03 2018

dev-appveyor-test

dev-appveyor-test https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mirko Pagliai

16/02 2018
01/06 2017

1.1.0

1.1.0.0 https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

AGPL

The Requires

 

The Development Requires

by Mirko Pagliai

21/03 2017

1.0.4

1.0.4.0 https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

AGPL

The Requires

 

The Development Requires

by Mirko Pagliai

06/11 2016

1.0.3

1.0.3.0 https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

AGPL

The Requires

 

The Development Requires

by Mirko Pagliai

24/10 2016

1.0.2

1.0.2.0 https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

AGPL

The Requires

 

The Development Requires

by Mirko Pagliai

17/10 2016

1.0.1

1.0.1.0 https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

AGPL

The Requires

 

The Development Requires

by Mirko Pagliai

13/10 2016

1.0.0

1.0.0.0 https://github.com/mirko-pagliai/cakephp-thumber

Thumber plugin for CakePHP

  Sources   Download

AGPL

The Requires

 

The Development Requires

by Mirko Pagliai