2017 © Pedro Peláez
 

yii2-extension yii2-image-resize

A Yii2 component for resizing images (on the fly)

image

noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

  • Sunday, February 18, 2018
  • by noam148
  • Repository
  • 3 Watchers
  • 6 Stars
  • 3,358 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 15 % Grown

The README.md

Image resize for Yii2

A Yii2 component for resizing images and store it in a cache folder, (*1)

Installation

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

  • Either run
php composer.phar require "noam148/yii2-image-resize" "*"

or add, (*3)

"noam148/yii2-image-resize" : "*"

to the require section of your application's composer.json file., (*4)

  • Add a new component in components section of your application's configuration file, for example:
'components' => [
    'imageresize' => [
        'class' => 'noam148\imageresize\ImageResize',
        //path relative web folder. In case of multiple environments (frontend, backend) add more paths 
        'cachePath' =>  ['assets/images', '../../frontend/web/assets/images'],
        //use filename (seo friendly) for resized images else use a hash
        'useFilename' => true,
        //show full url (for example in case of a API)
        'absoluteUrl' => false,
    ],
],

Usage

If you want to get a image url:, (*5)

/*
 * $sImageFilePath_id: (required) path to file
 * $width/$height: (required) width height of the image
 * $mode: "outbound", "inset" or "{horz}:{vert}" where {horz} is one from "left", "cetrer", "right" and {vert} is one from "top", "center", "bottom"
 * $$quality: (1 - 100)
 * $chosenFileName: if config -> components -> imageresize -> useFilename is true? its an option to give a custom name else use original file name
 */
\Yii::$app->imageresize->getUrl($sImageFilePath, $width, $height, $mode, $quality, $chosenFileName);

If you got questions, tips or feedback? Please, let me know!, (*6)

The Versions

18/02 2018

dev-master

9999999-dev https://github.com/noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

  Sources   Download

BSD-3-Clause

The Requires

 

component extension yii2 image resize on-the-fly

18/02 2018

1.1.0

1.1.0.0 https://github.com/noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

  Sources   Download

BSD-3-Clause

The Requires

 

component extension yii2 image resize on-the-fly

29/11 2016

1.0.1

1.0.1.0 https://github.com/noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

  Sources   Download

BSD-3-Clause

The Requires

 

component extension yii2 image resize on-the-fly

24/11 2016

1.0.0

1.0.0.0 https://github.com/noam148/yii2-image-resize

A Yii2 component for resizing images (on the fly)

  Sources   Download

BSD-3-Clause

The Requires

 

component extension yii2 image resize on-the-fly