scanerrr/yii2-local-image

Resize images and save to cache.

Installs: 29

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

pkg:composer/scanerrr/yii2-local-image

dev-master 2018-12-23 17:57 UTC

This package is auto-updated.

Last update: 2025-12-24 09:49:32 UTC


README

Simple Yii2 extension for resizing images and saving them to cache

Installation

Add yii2-local-image to the require section of your composer.json file:

{
    "require": {
        "scanerrr/yii2-local-image": "dev-master"
    }
}

Or simply run

php composer.phar require "scanerrr/yii2-local-image @dev"

Usage

Html::img(Image::resize($pathToImage, $width, $height = null));

Resize image with saving aspect ratio, simply miss "height"

Html::img(Image::resize($pathToImage, 120))

/* 
* Original image with resolution 1920x1080
* Result image gonna be 120x67
*/

TODO

  • Add CHANGELOG.md [ ]
  • Implement crop function [ ]
  • Allow to disable caching [ ]
  • Add tests [ ]
  • Add comments [ x ]
  • Add more extensions [ ]
  • Try to rewrite with Imagick [ ]