1

I'm using Symfony 3 and VichUploader. Here's my config:

vich_uploader:
    db_driver: orm
    mappings:
        photo:
            uri_prefix:         /uploads/photo
            upload_destination: %kernel.root_dir%/../web/uploads/photo

Now in my twig template, if I use: {{ vich_uploader_asset(member.photo, 'imageFile') }}, the uri generated is /uploads/photo/test.jpg, which doesn't work.

So i'm using {{ asset(vich_uploader_asset(member.photo, 'imageFile')) }}, which generates the right uri: /my_app_folder/web/uploads/photo/test.jpg

Shouldn't the vich_uploader_asset service generate the right uri by itself? Or do I have to put uri_prefix: /my_app_folder/web/uploads/photo in the VichUploader config?

I'm pretty sure I'm missing something here.

Roubi
  • 1,989
  • 1
  • 27
  • 36

1 Answers1

0

You should configure uri_prefix with /my_app_folder/web/uploads/photo if /my_app_folder/web/ really is the DocumentRoot of your app.

K-Phoen
  • 1,260
  • 9
  • 18
  • This looks weird. In the bundle docs, the uri_prefix example is `/images/products`. With assetic, when you do asset(/images/product/), the **/my_app_folder/web** part is added automaticaly. – Roubi Jan 12 '16 at 17:08