Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trntv/yii2-glide
Yii2 Glide integration component
https://github.com/trntv/yii2-glide
Last synced: 16 days ago
JSON representation
Yii2 Glide integration component
- Host: GitHub
- URL: https://github.com/trntv/yii2-glide
- Owner: trntv
- License: bsd-3-clause
- Created: 2015-04-07T20:22:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-12T14:14:55.000Z (over 5 years ago)
- Last Synced: 2024-10-14T06:28:21.291Z (29 days ago)
- Language: PHP
- Homepage: http://github.com/trntv/yii2-starter-kit
- Size: 842 KB
- Stars: 42
- Watchers: 8
- Forks: 21
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-yii2 - trntv/yii2-glide - Image manipulation components. (Core components)
README
Yii2 Glide
==========
Yii2 Glide integration.
> Glide is a wonderfully easy on-demand image manipulation library written in PHP.Before you start read [Glide documentation](http://glide.thephpleague.com/) to understand what we are doing
Demo
----
Since this package was created as a part of [yii2-starter-kit](https://github.com/trntv/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](http://getcomposer.org/download/).
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:
```php
'components' => [
...
'glide' => [
'class' => 'trntv\glide\components\Glide',
'sourcePath' => '@app/web/uploads',
'cachePath' => '@runtime/glide',
'signKey' => '' // "false" if you do not want to use HTTP signatures
],
...
]
```Then you can output modified image like so:
```php
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):
```php
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](https://github.com/trntv/yii2-starter-kit/tree/master/storage)Secure Urls
-----------
TBD