2017 © Pedro Peláez
 

cakephp-plugin cakephp-resize

Resize plugin for CakePHP

image

leoruhland/cakephp-resize

Resize plugin for CakePHP

  • Wednesday, February 17, 2016
  • by leoruhland
  • Repository
  • 2 Watchers
  • 3 Stars
  • 644 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 6 % Grown

The README.md

Resize plugin for CakePHP

Note: This is a non-stable plugin for CakePHP 3.x at this time. It is currently under development and should be considered experimental., (*1)

Installation

You can install this plugin into your CakePHP application using composer., (*2)

The recommended way to install composer packages is:, (*3)

composer require leoruhland/cakephp-resize

Now load the plugin:, (*4)

bin/cake plugin load -r Resize

You are all set! Now call your resized images like domain.com/resize/200x200/img/myself.png. The img/myself.png should be located into your webroot., (*5)

Configuration

To configure the plugin, you should add to your app\bootstrap.php:, (*6)

defaultSize (Default value: [100,100] )

Sets a defaultSize for invalid sizes., (*7)

Configure::write('Resize.defaultSize', [100, 100]);

sizes (Default value: [] )

Sets a array of allowed sizes to resize your images. (Fallback to defaultSize), (*8)

Configure::write('Resize.sizes', [100, 100]);

maxSize (Default value: [1920,1920] )

Sets a maxSize to resize your images. (Fallback to defaultSize), (*9)

Configure::write('Resize.maxSize', [1920, 1920]);

Usage

To resize a picture to 500x500, access the url of your picture(relative to webroot folder) prepending by resize/500x500/, (*10)

Example using the HtmlHelper image method:, (*11)

(In this case, you must go back one folder to access the root folder and not the images folder), (*12)

echo $this->Html->image('../resize/250x250/img/example.jpg');
echo $this->Html->image('../resize/250x250/uploads/articles/12/sample-article.jpg');

The Versions

17/02 2016

dev-master

9999999-dev

Resize plugin for CakePHP

  Sources   Download

The Requires

 

The Development Requires