8000 add compression function to image · LaravelResources/laravel-fileapi@3a29638 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a29638

Browse files
committed
add compression function to image
1 parent 5046bde commit 3a29638

File tree

3 files changed

+92
-124
lines changed

3 files changed

+92
-124
lines changed

readme.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
* Handle files with Laravel Storage.
66
* Load files through Laravel routing instead of public path.
7-
* Save images with thumbs, sizes are customisable.
7+
* Save images with thumbs, compressed image, and sizes are customisable.
88

99
## Installation
1010

@@ -56,6 +56,12 @@ in `config/fileapi.php`
5656
'default_thumbs' => ['S' => '96x96', 'M' => '256x256', 'L' => '480x480'],
5757
```
5858

59+
1. set default image compress quality
60+
61+
```php
62+
'compress_quality' => 90,
63+
```
64+
5965
1. choose whether you want to enable upload directly by url(api)
6066

6167
```php
@@ -127,7 +133,8 @@ $fa_article = new FileApi('/images/article/'); # initiate another instance
127133
```php
128134
$fa->get('wfj412.jpg'); // => get image url of 'L' size
129135
$fa->get('wfj412.jpg', 'M'); // => get image url of 'M' size
130-
$fa->get('wfj412.jpg', 'full); // => get image url of full size
136+
$fa->get('wfj412.jpg', 'full'); // => get image url of full size
137+
$fa->get('wfj412.jpg', 'CP'); // => get image url of compressed one
131138
```
132139

133140
### Delete image and thumbs

0 commit comments

Comments
 (0)
0