Skip to content
This repository has been archived by the owner on Mar 7, 2020. It is now read-only.

Commit

Permalink
Add a storage abstraction layer
Browse files Browse the repository at this point in the history
  • Loading branch information
gabiudrescu committed Jan 9, 2020
1 parent 7335095 commit ca8055e
Show file tree
Hide file tree
Showing 7 changed files with 218 additions and 4 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"guzzlehttp/guzzle": "^6.2",
"knplabs/doctrine-behaviors": "~1.1",
"liip/imagine-bundle": "^2.2",
"oneup/flysystem-bundle": "^3.3",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^5.0",
"sonata-project/block-bundle": "^3.3",
Expand Down
189 changes: 187 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true],
Oneup\FlysystemBundle\OneupFlysystemBundle::class => ['all' => true],
];
11 changes: 11 additions & 0 deletions config/packages/oneup_flysystem.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Read the documentation: https://github.com/1up-lab/OneupFlysystemBundle/tree/master/Resources/doc/index.md
oneup_flysystem:
adapters:
avatar_adapter:
local:
directory: '%kernel.project_dir%/public/media/avatar'
filesystems:
avatar_filesystem:
adapter: avatar_adapter
alias: League\Flysystem\Filesystem
mount: avatar_image_fs
3 changes: 2 additions & 1 deletion config/packages/vich_uploader.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
vich_uploader:
db_driver: orm
storage: flysystem

mappings:
admin_avatar:
uri_prefix: /media/avatar
upload_destination: '%kernel.project_dir%/public/media/avatar'
upload_destination: avatar_image_fs
namer: Vich\UploaderBundle\Naming\OrignameNamer
15 changes: 15 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
"lchrusciel/api-test-case": {
"version": "v3.1.3"
},
"league/flysystem": {
"version": "1.0.62"
},
"liip/imagine-bundle": {
"version": "1.8",
"recipe": {
Expand Down Expand Up @@ -338,6 +341,18 @@
"ocramius/proxy-manager": {
"version": "2.2.0"
},
"oneup/flysystem-bundle": {
"version": "3.0",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "3.0",
"ref": "0eb87bba411c227da027fe5f7c1dc7954b02f242"
},
"files": [
"config/packages/oneup_flysystem.yaml"
]
},
"openlss/lib-array2xml": {
"version": "0.0.10"
},
Expand Down
2 changes: 1 addition & 1 deletion templates/backend/form/theme.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<div id="{{ form.vars.id }}">
<label for="{{ form.file.vars.id }}" class="ui icon labeled button"><i class="cloud upload icon"></i> {{ 'sylius.ui.choose_file'|trans }}</label>
{% if file.path|default(null) is not null %}
<img class="ui medium bordered image" src="{{ vich_uploader_asset(file, 'file')|imagine_filter('default') }}" alt="{{ form.vars.value.type }}" />
<img class="ui medium bordered image" src="{{ vich_uploader_asset(file, 'file')|imagine_filter('default') }}" alt="{{ form.vars.value.path }}" />
{% endif %}
<div class="ui hidden element">
{{ form_widget(form.file) }}
Expand Down

0 comments on commit ca8055e

Please sign in to comment.