Skip to content

Commit 71994d7

Browse files
committed
2 parents d1974e1 + f4c533c commit 71994d7

39 files changed

+469
-192
lines changed

docs/build/doctrees/commands.doctree

-4 Bytes
Binary file not shown.
7.89 KB
Binary file not shown.
357 Bytes
Binary file not shown.

docs/build/doctrees/index.doctree

1 Byte
Binary file not shown.
1 Byte
Binary file not shown.

docs/build/doctrees/media.doctree

1 Byte
Binary file not shown.

docs/build/doctrees/mediable.doctree

-57 Bytes
Binary file not shown.

docs/build/doctrees/types.doctree

-4 Bytes
Binary file not shown.

docs/build/doctrees/uploader.doctree

-4 Bytes
Binary file not shown.

docs/build/html/.buildinfo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 2722b2b5df7612bff4385ecba0d7e59f
3+
config: bbf7cac85fbbf9441e0e7eba39880a50
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

docs/build/html/_sources/configuration.txt

+85-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ An example setup with one private disk (``local``) and one publicly accessible d
1414

1515
::
1616

17+
<?php
1718
//...
1819
'disks' => [
1920
'local' => [
@@ -33,6 +34,7 @@ Once you have set up as many disks as you need, edit ``config/mediable.php`` to
3334

3435
::
3536

37+
<?php
3638
//...
3739
/*
3840
* Filesystem disk to use if none is specified
@@ -47,6 +49,85 @@ Once you have set up as many disks as you need, edit ``config/mediable.php`` to
4749
],
4850
//...
4951

52+
53+
Disk Visibility
54+
^^^^^^^^^^^^^^^
55+
56+
This package is able to generate public URLs for accessing media, and uses the disk config to determine how this should be done.
57+
58+
URLs can always be generated for ``Media`` placed on a disk located below the webroot.
59+
60+
::
61+
62+
<?php
63+
'disks' => [
64+
'uploads' => [
65+
'driver' => 'local',
66+
'root' => public_path('uploads'),
67+
],
68+
]
69+
70+
//...
71+
72+
$media->getUrl(); // returns http://domain.com/uploads/foo.jpg
73+
74+
``Media`` placed on a disk located elsewhere will throw an exception.
75+
76+
::
77+
78+
<?php
79+
'disks' => [
80+
'private' => [
81+
'driver' => 'local',
82+
'root' => storage_path('private'),
83+
],
84+
]
85+
86+
//...
87+
88+
$media->getUrl(); // Throws a Plank\Mediable\Exceptions\MediableUrlException
89+
90+
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.
91+
92+
::
93+
94+
<?php
95+
'disks' => [
96+
'public' => [
97+
'driver' => 'local',
98+
'root' => storage_path('public'),
99+
'visibility' => 'public',
100+
'prefix' => 'assets'
101+
],
102+
]
103+
104+
//...
105+
106+
$media->getUrl(); // returns http://domain.com/assets/foo.jpg
107+
108+
109+
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 congfig.
110+
111+
::
112+
113+
<?php
114+
'disks' => [
115+
'cloud' => [
116+
'driver' => 's3',
117+
'key' => env('S3_KEY'),
118+
'secret' => env('S3_SECRET'),
119+
'region' => env('S3_REGION'),
120+
'bucket' => env('S3_BUCKET'),
121+
'version' => 'latest',
122+
'visibility' => 'public'
123+
],
124+
]
125+
126+
//...
127+
128+
$media->getUrl(); // returns https://s3.amazonaws.com/bucket/foo.jpg
129+
130+
50131
.. _validation:
51132

52133
Validation
@@ -56,6 +137,7 @@ The `config/mediable.php` offers a number of options for configuring how media u
56137

57138
::
58139

140+
<?php
59141
//...
60142
/*
61143
* The maximum file size in bytes for a single uploaded file
@@ -106,10 +188,11 @@ Aggregate Types
106188

107189
Laravel-Mediable provides functionality for handling multiple kinds of files under a shared aggregate type. This is intended to make it easy to find similar media without needing to constantly juggle multiple MIME types or file extensions.
108190

109-
The package defines a number of common file types in the config file (config/mediable.php). Feel free to modify the default types provided by the package or add your own. Each aggregate type requires a key used to identify the type and a list of MIME types and file extensions that should be recognized as belonging to that aggregate type. For example, if you wanted to add an aggregate type for different types of markup, you could do the following.
191+
The package defines a number of common file types in the config file (``config/mediable.php``). Feel free to modify the default types provided by the package or add your own. Each aggregate type requires a key used to identify the type and a list of MIME types and file extensions that should be recognized as belonging to that aggregate type. For example, if you wanted to add an aggregate type for different types of markup, you could do the following.
110192

111193
::
112194

195+
<?php
113196
//...
114197
'aggregate_types' => [
115198
//...
@@ -145,6 +228,7 @@ The ``config/mediable.php`` file lets you specify a number of classes to be use
145228

146229
::
147230

231+
<?php
148232
/*
149233
* FQCN of the model to use for media
150234
*

docs/build/html/_sources/mediable.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ You can retrieve media attached to a file by refering to the tag to which it was
7272
<?php
7373
$media = $post->getMedia('thumbnail');
7474

75-
This returns a collection of all media assigned to that tag. In cases where you only need one `Media` entity, you can instead use `firstMedia()`.
75+
This returns a collection of all media assigned to that tag. In cases where you only need one ``Media`` entity, you can instead use ``firstMedia()``.
7676

7777
::
7878

docs/build/html/commands.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1010

11-
<title>Artisan Commands &mdash; Laravel-Mediable 2.0.0 documentation</title>
11+
<title>Artisan Commands &mdash; Laravel-Mediable 2.2.0 documentation</title>
1212

1313

1414

@@ -30,7 +30,7 @@
3030

3131

3232

33-
<link rel="top" title="Laravel-Mediable 2.0.0 documentation" href="index.html"/>
33+
<link rel="top" title="Laravel-Mediable 2.2.0 documentation" href="index.html"/>
3434
<link rel="prev" title="Aggregate Types" href="types.html"/>
3535

3636

@@ -59,7 +59,7 @@
5959

6060

6161
<div class="version">
62-
2.0.0
62+
2.2.0
6363
</div>
6464

6565

@@ -192,7 +192,7 @@ <h1>Artisan Commands<a class="headerlink" href="#artisan-commands" title="Permal
192192
<script type="text/javascript">
193193
var DOCUMENTATION_OPTIONS = {
194194
URL_ROOT:'./',
195-
VERSION:'2.0.0',
195+
VERSION:'2.2.0',
196196
COLLAPSE_INDEX:false,
197197
FILE_SUFFIX:'.html',
198198
HAS_SOURCE: true

0 commit comments

Comments
 (0)