forked from spatie/laravel-medialibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* wip * wip * wip * wip * fix case * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * update javascript docs * update javascript docs * wip JS components documentation * wip javascript components documentation * wip * wip * wip * Update handling-uploads-with-vue-or-react.md * Fix styling * wip * wip * wip * wip * wip * wip * wip * wip * wip * Fix styling * remove translations * wip * wip * wip * Fix styling * update props * improve conversions (spatie#2101) * wip * Fix styling * wip * wip * Fix styling * wip * wip * Fix styling * wip * wip * wip * wip * wip * wip * Fix styling * wip Co-authored-by: freekmurze <[email protected]> * update * document maxSizeForPreviewInBytes * wip * wip * Rework frontend docs * Rework frontend docs * Restore data code blocks * wip * wip * Update general upload guide * Words * Words * Doc updates * wip * Fix styling * wip * wip * wip * use v9 links * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * v9 * wip * wip * wip * wip * wip * wip * wip * correct year * wip * docs: css installation * wip * Custom CSS * Custom CSS * Custom CSS * Custom CSS * Custom CSS * docs: update JS UI components * wip js docs * wip * wip * update validation property name * update for Vue 3 * updates for Vue 3 * Set height attribute (spatie#2132) * update naming * typo * wip * reorder sections * capitalize CSS * wip * wip * wip * add jsonSerialize to MediaCollection * update slot usage for Vue 3 * fix getting old values * Fix styling * fix last commit * File namer#1784 (spatie#2114) * support a custom file namer for responsive images * Fix styling * apply code review suggestions * let conversions use a new file namer class * add documentation * cleanup last conversion file namer parts * apply code review suggestions * split up conversion & responsive file namer * remove get prefix on FileNamer methods * Update naming-generated-files.md * Update naming-generated-files.md Co-authored-by: Nielsvanpach <[email protected]> Co-authored-by: Freek Van der Herten <[email protected]> * wip * wip * update docs with new endpoints * wip * wip * drop laravel 6 * wip * update vapor config * wip * update upload endpoint * update paths * allow PHP 8 * wip * remove notice * add enable_vapor_uploads option + restructure config file * wip * wip * wip * find last occurence of starting characters (spatie#2140) * find last occurence of starting characters if a filename ends with _, the responsive image will have four underscores in its name. We used to trim at the first occurence, so the collection name starts with an underscore. This way responsive image will not get rendered as expected. Now, we will trim on the last occurence and the collection name will not start with an underscore in this case. * fix test case Co-authored-by: Adriaan <[email protected]> Co-authored-by: freekmurze <[email protected]> Co-authored-by: Sebastian De Deyne <[email protected]> Co-authored-by: Willem Van Bockstal <[email protected]> Co-authored-by: Robin Cramer <[email protected]> Co-authored-by: AdrianMrn <[email protected]> Co-authored-by: Niels Vanpachtenbeke <[email protected]> Co-authored-by: Nielsvanpach <[email protected]>
- Loading branch information
Showing
81 changed files
with
2,997 additions
and
521 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: v8 | ||
title: v9 | ||
slogan: Associate files with Eloquent models. | ||
githubUrl: https://github.com/spatie/laravel-medialibrary | ||
branch: master | ||
branch: v9 | ||
--- |
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,55 @@ | ||
--- | ||
title: Naming generated files | ||
weight: 11 | ||
--- | ||
|
||
### Naming conversion files | ||
|
||
By default, all conversion files will be named in this format: | ||
|
||
``` | ||
{original-file-name-without-extension}-{name-of-the-conversion}.{extension} | ||
``` | ||
|
||
Should you want to name your conversion file using another format, | ||
then you can specify the class name of your own `FileNamer` in the `file_namer` key | ||
of the `media-library.php` config file. | ||
|
||
The only requirements is that your class extends `Spatie\MediaLibrary\Support\FileNamer`. | ||
In your class you should implement 2 methods: | ||
1. `conversionFileName` should return the media file name combined with the conversion name | ||
2. `responsiveFileName` should return the media file name | ||
|
||
Here is the implementation of `Spatie\MediaLibrary\Support\FileNamer\DefaultFileNamer` | ||
|
||
```php | ||
namespace Spatie\MediaLibrary\Support\FileNamer; | ||
|
||
use Spatie\MediaLibrary\Conversions\Conversion; | ||
|
||
class DefaultFileNamer extends FileNamer | ||
{ | ||
public function conversionFileName(string $fileName, Conversion $conversion): string | ||
{ | ||
$strippedFileName = pathinfo($fileName, PATHINFO_FILENAME); | ||
|
||
return "{$strippedFileName}-{$conversion->getName()}"; | ||
} | ||
|
||
public function responsiveFileName(string $fileName): string | ||
{ | ||
return pathinfo($fileName, PATHINFO_FILENAME); | ||
} | ||
} | ||
``` | ||
|
||
### Naming responsive image files | ||
|
||
By default, all responsive image files will be named in this format: | ||
|
||
``` | ||
{original-file-name-without-extension}___{name-of-the-conversion}_{width}_{height}.{extension} | ||
``` | ||
|
||
Just like the conversion file names, you can use another format for naming your files | ||
by using your own `FileNamer` class. It is only possible to prefix the name, because other parts are needed in processing responsive images. |
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.