You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Changelog
2
2
3
+
## 4.0.0
4
+
- changed UrlGenerators to use the underlying filesystemAdapter's `url()` method
5
+
- UrlGenerators no longer throw `MediaUrlException` when the file does not have public visibility. This removes the need to read IO for files local disks or to make HTTP calls for files on s3 disks.
6
+
- Removed `LocalUrlGenerator::getPublicPath()`
7
+
- No longer reading the `'prefix'` config of local disks. Value should be included in the `'url'` config instead.
8
+
3
9
## 3.0.1 - 2019-09-18
4
10
- Fixed public visibility not being respected when generating URLs for local files that are not in the webroot.
Copy file name to clipboardExpand all lines: UPGRADING.md
+6
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Upgrading
2
2
3
+
## 3.x to 4.x
4
+
5
+
* UrlGenerators no longer throw `MediaUrlException` when the file does not have public visibility. This removes the need to read IO for files local disks or to make HTTP calls for files on s3 disks. Visibility can still checked with `$media->isPubliclyAccessible()`, if necessary.
6
+
* Highly recommended to explicitly specify the `'url'` config value on all disks used to generate URLs.
7
+
* No longer reading the `'prefix'` config of local disks. Value should be included in the `'url'` config instead.
Copy file name to clipboardExpand all lines: docs/source/configuration.rst
+5-117
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,6 @@ Disks
10
10
------------------------
11
11
Laravel-Mediable is built on top of Laravel's Filesystem component. Before you use the package, you will need to configure the filesystem disks where you would like files to be stored in ``config/filesystems.php``. `Learn more about filesystem disk <https://laravel.com/docs/5.2/filesystem>`_.
12
12
13
-
An example setup with one private disk (``local``) and one publicly accessible disk (``uploads``):
14
-
15
13
::
16
14
17
15
<?php
@@ -20,11 +18,15 @@ An example setup with one private disk (``local``) and one publicly accessible d
20
18
'local' => [
21
19
'driver' => 'local',
22
20
'root' => storage_path('app'),
21
+
'url' => 'https://example.com/storage/app',
22
+
'visibility' => 'public'
23
23
],
24
24
25
25
'uploads' => [
26
26
'driver' => 'local',
27
27
'root' => public_path('uploads'),
28
+
'url' => 'https://example.com/uploads',
29
+
'visibility' => 'public'
28
30
],
29
31
]
30
32
//...
@@ -45,125 +47,11 @@ Once you have set up as many disks as you need, edit ``config/mediable.php`` to
45
47
* Filesystems that can be used for media storage
46
48
*/
47
49
'allowed_disks' => [
50
+
'local',
48
51
'uploads',
49
52
],
50
53
//...
51
54
52
-
.. _disk_visibility:
53
-
54
-
Disk Visibility
55
-
^^^^^^^^^^^^^^^
56
-
57
-
This package is able to generate public URLs for accessing media, and uses the disk config to determine how this should be done.
58
-
59
-
URLs can always be generated for ``Media`` placed on a disk located below the webroot.
``Media`` placed on a disk located elsewhere will throw an exception.
76
-
77
-
::
78
-
79
-
<?php
80
-
'disks' => [
81
-
'private' => [
82
-
'driver' => 'local',
83
-
'root' => storage_path('private'),
84
-
],
85
-
]
86
-
87
-
//...
88
-
89
-
$media->getUrl(); // Throws a Plank\Mediable\Exceptions\MediableUrlException
90
-
91
-
If you are using symbolic links to make local disks accessible, you can instruct the package to generate URLs with the ``'visibility' => 'public'`` key. By default, the package will assume that the symlink is named ``'storage'``, as per `laravel's documentation <https://laravel.com/docs/5.3/filesystem#the-public-disk>`_. This can be modified with the ``'prefix'`` key.
Whether you are using symbolic links or not, you can set the ``'url'`` config value to generate disk urls on another domain. Note that you can specify any path in the url, as the root path doesn't have to match, as long as you have set up your web server accordingly.
Permissions for S3-based disks is set on the buckets themselves. You can inform the package that ``Media`` on an S3 disk can be linked by URL by adding the ``'visibility' => 'public'`` key to the disk config.
0 commit comments