|
4 | 4 |
|
5 | 5 | * Handle files with Laravel Storage. |
6 | 6 | * 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. |
8 | 8 |
|
9 | 9 | ## Installation |
10 | 10 |
|
@@ -56,6 +56,12 @@ in `config/fileapi.php` |
56 | 56 | 'default_thumbs' => ['S' => '96x96', 'M' => '256x256', 'L' => '480x480'], |
57 | 57 | ``` |
58 | 58 |
|
| 59 | +1. set default image compress quality |
| 60 | + |
| 61 | + ```php |
| 62 | + 'compress_quality' => 90, |
| 63 | + ``` |
| 64 | + |
59 | 65 | 1. choose whether you want to enable upload directly by url(api) |
60 | 66 |
|
61 | 67 | ```php |
@@ -109,27 +115,28 @@ $fa_article = new FileApi('/images/article/'); # initiate another instance |
109 | 115 | ```php |
110 | 116 | $file = $fa |
111 | 117 | ->thumbs([ |
112 | | - 'S' => '150x100', |
113 | | - 'M' => '300x200', |
114 | | - 'L' => '450x300' |
115 | | - ]) |
| 118 | + 'S' => '150x100', |
| 119 | + 'M' => '300x200', |
| 120 | + 'L' => '450x300' |
| 121 | + ]) |
116 | 122 | ->save(\Input::file('main_image')); |
117 | 123 | ``` |
118 | 124 |
|
119 | 125 | * make cropped thumbs |
120 | 126 |
|
121 | | - ```php |
122 | | - $file = $fa->crop()->save(\Input::file('main_image')); |
123 | | - ``` |
| 127 | + ```php |
| 128 | + $file = $fa->crop()->save(\Input::file('main_image')); |
| 129 | + ``` |
124 | 130 |
|
125 | 131 | ### Get image url |
126 | 132 |
|
127 | 133 | ```php |
128 | 134 | $fa->get('wfj412.jpg'); // => get image url of 'L' size |
129 | 135 | $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 |
131 | 138 | ``` |
132 | | - |
| 139 | + |
133 | 140 | ### Delete image and thumbs |
134 | 141 |
|
135 | 142 | ```php |
|
0 commit comments