Skip to content
Yii2 Glide integration component
PHP
Branch: master
Clone or download
trntv Merge pull request #30 from ddinchev/master
Fix a bug related to manipulators order.
Latest commit 7393e87 Aug 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests Tests improvements Apr 26, 2018
.gitignore init Apr 7, 2015
.travis.yml travis ci support Apr 6, 2016
LICENSE
README.md Update README.md Apr 26, 2018
composer.json PHPUnit 6, PHP 7.2 support (Closes #15, closes #24) Apr 26, 2018
phpunit.xml.dist 100% code coverage Apr 26, 2018

README.md

Yii2 Glide

Yii2 Glide integration.

Glide is a wonderfully easy on-demand image manipulation library written in PHP.

Before you start read Glide documentation to understand what we are doing

Demo

Since this package was created as a part of yii2-starter-kit it's demo can be found in starter kit demo.

Contributing

You can contribute anything you found useful in any convenient way. Any help appreciated.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist trntv/yii2-glide

or add

"trntv/yii2-glide": "^1.0"

to the require section of your composer.json file.

Usage

Add glide configuration:

'components' => [
    ...
    'glide' => [
        'class' => 'trntv\glide\components\Glide',
        'sourcePath' => '@app/web/uploads',
        'cachePath' => '@runtime/glide',
        'signKey' => '<random-key>' // "false" if you do not want to use HTTP signatures
    ],
    ...
]

Then you can output modified image like so:

Yii::$app->glide->outputImage('new-upload.jpg', ['w' => 100, 'fit' => 'crop'])

You can also use trntv\glide\actions\GlideAction to output images: In any controller add (SiteController for example):

public function actions()
{
    return [
        'glide' => 'trntv\glide\actions\GlideAction'
    ]
}

Than use it: /index.php?r=site/glide?path=new-upload.jpg&w=100&h=75

Example

Complex Glide integration example can be found here

Secure Urls

TBD

You can’t perform that action at this time.