This repository has been archived by the owner on Mar 5, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.1.0
- Loading branch information
Showing
26 changed files
with
678 additions
and
290 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Getting a file path and URL | ||
|
||
The path and filename of a stored file in the storage backend that was used to store the file is generated by a [path builder](Path-Builders.md). The event listener that stored your file has used a path builder to generate the path based on the entity data. This means that if you have the entity and instantiate a path builder you can build the path to it in any place. | ||
|
||
The plugin already provides you with several convenience short cuts to do that. | ||
|
||
Be aware that whenever you use a path builder somewhere, you **must** use the same path builder and options as when the entity was created. They're usually the same as configured in your event listener. | ||
|
||
## Getting it from an entity | ||
|
||
While you can do this technically it is **not** the *recommended* way of doing it depending on your overall implementation. | ||
|
||
TBD | ||
|
||
## Getting it using the storage helper | ||
|
||
The storage helper is basically just a proxy to a path builder. The helper takes two configuration options: | ||
|
||
* **pathBuilder**: Name of the path builder to use. | ||
* **pathBuilderOptions**: The options passed to the path builders constructor. | ||
|
||
Make sure that the options you pass and the path builder are the same you've used when you uploaded the file! Otherwise you end up with a different path! | ||
|
||
```php | ||
// Load the helper | ||
$this->loadHelper('Burzum/FileStorage.Storage', [ | ||
'pathBuilder' => 'Base', | ||
//The builder options must match the options and builder class that were used to store the file. | ||
'pathBuilderOptions' => [ | ||
'modelFolder' => true, | ||
] | ||
]); | ||
|
||
// Use it in your views | ||
$url = $this->Storage->url($yourEntity); | ||
|
||
// Change the path builder at run time | ||
// Be carefully, this will change the path builder instance in the helper! | ||
$this->Storage->pathBuilder('SomePathBuilder', ['options' => 'here']); | ||
``` | ||
|
||
## Getting image versions using the image helper | ||
|
||
TBD | ||
|
||
## Getting it via events | ||
|
||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.